Document: queryCommandEnabled() ã¡ã½ãã
Deprecated
Avoid using this feature in new projects.
The execCommand() method is "not implemented consistently or fully by user agents, and it is not expected that this will change in the foreseeable future."
This feature may be a candidate for removal from web standards or browsers. >
Consider using the following features instead: Async clipboardã¾ãã¯contenteditable. >
鿍æº: ãã®æ©è½ã¯æ¨æºåããã¦ãã¾ããã鿍æºã®æ©è½ã¯ãã©ã¦ã¶ã¼ã®å¯¾å¿ãéãããå°æ¥çã«å¤æ´ã¾ãã¯åé¤ãããå¯è½æ§ããããããæ¬çªç°å¢ã§ã®ä½¿ç¨ã¯æ¨å¥¨ããã¾ããããã ããæ¨æºã®é¸æè¢ãåå¨ããªãç¹å®ã®ã±ã¼ã¹ã§ã¯ãæå¹ãªä»£æ¿ææ®µã¨ãªãå ´åãããã¾ãã
The Document.queryCommandEnabled() ã¡ã½ããã¯ãæå®ããã¨ãã£ã¿ã¼ã³ãã³ãããã©ã¦ã¶ã¼ã§æå¹ã«ãªã£ã¦ãããã©ãããå ±åãã¾ãã
æ§æ
document.queryCommandEnabled(command)
弿°
command-
対å¿ãããã©ããã夿ããã³ãã³ãã
è¿å¤
è«çå¤ã§ãã³ãã³ããæå¹ãªå ´å㯠trueãç¡å¹ãªå ´å㯠false ãè¿ãã¾ãã
ã¡ã¢
- '
cut' ããã³ 'copy' ã³ãã³ãã®å ´åããã®ã¡ã½ããã¯ã¦ã¼ã¶ã¼ãèµ·åããã¹ã¬ããããå¼ã³åºãããã¨ãã®ã¿ true ãè¿ãã¾ãã 'paste'ã³ãã³ãã¯ããã®æ©è½ãå©ç¨ã§ããªãå ´åã ãã§ãªããå¼ã³åºãããã¹ã¯ãªããããã®ã¢ã¯ã·ã§ã³ãå®è¡ããã®ã«ååãªæ¨©éãæã£ã¦ããªãå ´åã«ãfalseãè¿ãã¾ãã
ä¾
const flg = document.queryCommandEnabled("SelectAll");
if (flg) {
document.execCommand("SelectAll", false, null); // ã³ãã³ããæå¹ãªã®ã§ãå®è¡ãã
}
仿§æ¸
ãã®æ©è½ã¯ã©ã®ç¾è¡ä»æ§ã«ãå±ãã¦ãã¾ãããæ¨æºåã®äºå®ã¯ãªããªãã¾ããã