execcommand

execCommand() is now obsolete, what's the alternative?

两盒软妹~` 提交于 2020-06-13 17:32:36
问题 I intended to use Document.execCommand() method along with contenteditable attribute to build my custom WYSIWYG editor. But when I checked the documentation for Document.execCommand() , I found that it's now obsolete. What's the modern (or extant) alternative for it? 回答1: I created the Rich Editor for my platform's XML (HTML5 + XHTML) editing purposes. I would not say that document.execCommand() is completely dead because some parts of it still work fine. Unfortunately the primary issue for

execCommand() is now obsolete, what's the alternative?

放肆的年华 提交于 2020-06-13 17:31:20
问题 I intended to use Document.execCommand() method along with contenteditable attribute to build my custom WYSIWYG editor. But when I checked the documentation for Document.execCommand() , I found that it's now obsolete. What's the modern (or extant) alternative for it? 回答1: I created the Rich Editor for my platform's XML (HTML5 + XHTML) editing purposes. I would not say that document.execCommand() is completely dead because some parts of it still work fine. Unfortunately the primary issue for

Is there something better than document.execCommand?

自古美人都是妖i 提交于 2020-04-08 09:10:42
问题 When implementing a web-based rich-text editor, I read that document.execCommand is useful for performing operations on an HTML document (like making a selection bold). However, I need something a bit better. Specifically, I need to know exactly what text is added or removed from the innerHTML, and in what location (as an offset into the entire document's HTML representation). I considered using the built in document.execCommand along side DOM4's mutation observer, but execCommand doesn't

Is there something better than document.execCommand?

爷,独闯天下 提交于 2020-04-08 09:09:03
问题 When implementing a web-based rich-text editor, I read that document.execCommand is useful for performing operations on an HTML document (like making a selection bold). However, I need something a bit better. Specifically, I need to know exactly what text is added or removed from the innerHTML, and in what location (as an offset into the entire document's HTML representation). I considered using the built in document.execCommand along side DOM4's mutation observer, but execCommand doesn't

jQuery execCommand for superscript and subscript not properly toggling

岁酱吖の 提交于 2020-01-05 05:45:46
问题 I'm trying to create a text editor using jQuery and execCommand . Everything was going good until I noticed that both superscript and subscript aren't properly toggling. This jsFiddle (http://jsfiddle.net/k8F4P/) should illustrate the problem. It is possible that it is simply my browser, but I'm using the latest version of Chrome for Mac. 回答1: Turned out the issue was that the stylesheet normalize.css was setting the sub and sup tags' vertical-align to baseline and this was preventing the

“execCommand” is not working with AngularJS

穿精又带淫゛_ 提交于 2019-12-31 05:08:05
问题 In the process of creating my own mini/simplified text editor I ran into the issue of using execCommand. I do not know why my code isn't working. I tried to prevent the mousedown event and used the attribute "unsetectable="on" " but it still doesn't seem to work. Here's my code: <button type="button" class="btn btn-default" ng-click="makeBold()" unselectable="on" ng-mousedown="$event.stopPropagation()">B</button> and $scope.makeBold = function(){ document.execCommand('bold',false,null); };

Is there a way to determine if execCommand('undo') is executable? [JavaScript]

自作多情 提交于 2019-12-31 02:34:11
问题 I am trying to determine if the execCommand('undo') can be executed. I've tried this one: if(document.execCommand('undo')) { document.execCommand('redo'); // some code } and it works... But it makes me some problems with the other part of the script. Is there another way to see if 'undo' is executable ? Thanks in advance! 回答1: document.queryCommandSupported http://msdn.microsoft.com/en-us/library/ms536681(VS.85).aspx document.queryCommandEnabled http://msdn.microsoft.com/en-us/library

Definition of ExecCommand function for bold?

谁都会走 提交于 2019-12-30 05:16:12
问题 ExecCommand offers a way to bold text inside iFrame, make it italic, underline it etc. But it's missing an option to create <cite> or <strong> or <em> (there is formatBlock but only for block elements and not inline ones). I'd like to use ExecCommand function for creating <cite> - is there any way to achieve this? And obviously I want to maintain flawless parsing like in case of bold and not something like surroundContents which will fail when you use it twice on the same selection. I'm

ZeroClipboard的时代或许已经过去了

邮差的信 提交于 2019-12-27 18:08:06
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 曾经,一个网页上要用Javascript实现网页内容的复制,其实是很麻烦的一件事情。虽然在这个问题上IE有其高大上的 window.clipboardData 方法支持直接复制指定内容,Firefox也早早的支持了 document.execCommand 命令,但是因为早期的Chrome不支持浏览器直接操作剪贴板,或者说不支持 document.execCommand 命令,让这一功能在兼容性上遇到了瓶颈。所以,聪明的开发者们开始走上“曲线救国”的道路:借助各大浏览器对Flash的支持,通过Javascript与Flash交互,将需要复制的内容传递到Flash中,再调用Flash操作剪切板的命令将内容复制到剪贴板,从而实现了兼容性极强的通过JS脚本复制网页文本的插件。这也就是 ZeroClipboard 的使命。 The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface. ZeroClipboard曾盛极一时,而如今它的未来,恐怕令人担忧。随着HTML5的风靡

Check if selection contains link

心不动则不痛 提交于 2019-12-24 18:59:32
问题 I am creating a rich text editor and I would like to use the same button to link and unlink selections. document.execCommand('createLink'...) and document.execCommand('unlink'...) allow users to link and unlink window.getSelection().toString() . However, there are no inbuilt methods to determine whether a selection is linked or not in the first place, so my question is: How can you check whether or not a selection is linked? I have tried using document.queryCommandState('createLink') and