wysihtml5

'Range.detach' is now a no-op, as per DOM

百般思念 提交于 2019-12-30 21:01:07
问题 I have been noticing this warning and error message in my console after updating Chrome to 36.0.1985.125. Warning: 'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-range-detach). Error: Discontiguous selection is not supported. Can be seen: http://rangy.googlecode.com/svn/trunk/demos/cssclassapplier.html Other javascript/jquery plugins (wysihtml5, rangy) have also been affected, any solutions? 回答1: I'm still trying to decide what to do about this. See this Rangy

'Range.detach' is now a no-op, as per DOM

老子叫甜甜 提交于 2019-12-30 21:01:04
问题 I have been noticing this warning and error message in my console after updating Chrome to 36.0.1985.125. Warning: 'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-range-detach). Error: Discontiguous selection is not supported. Can be seen: http://rangy.googlecode.com/svn/trunk/demos/cssclassapplier.html Other javascript/jquery plugins (wysihtml5, rangy) have also been affected, any solutions? 回答1: I'm still trying to decide what to do about this. See this Rangy

Insert HTML programmatically in wysiHTML5 editor

瘦欲@ 提交于 2019-12-21 04:04:29
问题 I found javascript wysiwyg editor wysiHTML5. I'm trying to add element <a href=...> to the editor or just turn on bold programmatically. My code is: var editor = new wysihtml5.Editor("textarea", { toolbar: "toolbar", stylesheets: "css/wysihtml5.css", parserRules: wysihtml5ParserRules }); editor.observe("load", function() { editor.composer.commands.exec("bold"); }); Am I doing something wrong? 回答1: Actually no, but you have to be sure that your textarea (iframe) is focused. Try to use on

How to add a non editable tag to content in Quill editor

偶尔善良 提交于 2019-12-12 07:26:57
问题 I want to add a couple of pre-built labels like <div class="label"> Label Text <span>x</span><div> to the html content in the quill editor. Add such a tag should not be a problem in itself. However I don't want the user to be able to edit the text inside the label. The cursor should not even be allowed to be placed inside the label. On delete the whole div should be deleted. The whole label should act like an image in some sense. Is it possible ? 回答1: You should be able to achieve this by

How to handle wysihtml5`s br and nbsp?

戏子无情 提交于 2019-12-11 08:55:58
问题 I'm using wysihtml5 editor and having some problems with the output. When I hit return I get a line break which is OK, but the tag isn't valid XHTML. It uses <br> instead of <br /> . The other problem I experienced is when I create two spaces. I then get the   element, which makes my XML parser fail.. Anyone know how to remove these from occurring? 回答1: The following codes provide text content(without html tags) and html content(with html tags). Who wants which of them; textContent = document

How to Toggle / remove classes in wysihtml5

六眼飞鱼酱① 提交于 2019-12-11 07:35:53
问题 I need to be able remove the previous class from a span when adding a new one. Below is the custom function which adds a span and a class that gets passed through the button. wysihtml5.commands.custom_underline = { exec: function(composer, command, className) { return wysihtml5.commands.formatInline.exec(composer, command, "span", className, new RegExp(className, "g")); }, state: function(composer, command, className) { return wysihtml5.commands.formatInline.state(composer, command, "span",

How do I deactivate Bootstrap-wysihtml5 jquery editor instance?

陌路散爱 提交于 2019-12-10 21:07:59
问题 I'm using the Bootstrap-wysihtml5 jquery plugin (https://github.com/jhollingworth/bootstrap-wysihtml5/) to convert textareas to WYSIWYG. I would like to be able to activate and deactivate the editor by clicking on 2 buttons, so far i can show the editor, please will you let me know how i can deactivate the editor and leave just the textarea and its value. My code is as follows:- HTML <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> <input type="button" id="button1" value

Programmatically retrieve content from WYSIHTML5 editor

拈花ヽ惹草 提交于 2019-12-10 14:59:16
问题 How do I programmatically retrieve content from a WYSIHTML5 editor? Suppose the editor is instantiated as this: var editor = new wysihtml5.Editor ( $(this.el).find('textarea').get(0), { toolbar: "toolbar", parserRules: wysihtml5ParserRules } ); i would like to get the editor's content on blur event editor.on ( "blur", function() { //what here? } ); 回答1: It's much better to use the API editor.getValue() (@dalen mentioned this in the comment above) 回答2: Here is how (using jQuery here): $(

How to disabled wysihtml5 HTML Clean Up in Editor?

两盒软妹~` 提交于 2019-12-03 17:37:06
问题 How to disable HTML Clean Up while in the editor mode? I'm in a need of allowing css format & inline html in code. The idea is to disable parser and html clean up action when pasting the code and entering the Editor for editing. Thanks. 回答1: Actually, this is what the parser rules are for. You can attach your custom rules to the included var wysihtml5ParserRules before instantiate the editor object or just create your own rules object and give to the editor's constructor. For example, to

Insert HTML programmatically in wysiHTML5 editor

て烟熏妆下的殇ゞ 提交于 2019-12-03 12:40:53
I found javascript wysiwyg editor wysiHTML5 . I'm trying to add element <a href=...> to the editor or just turn on bold programmatically. My code is: var editor = new wysihtml5.Editor("textarea", { toolbar: "toolbar", stylesheets: "css/wysihtml5.css", parserRules: wysihtml5ParserRules }); editor.observe("load", function() { editor.composer.commands.exec("bold"); }); Am I doing something wrong? Actually no, but you have to be sure that your textarea (iframe) is focused. Try to use on instead of observe . Here is a sample code that worked for me with insertHTML. editor.on("load", function() {