yui-editor

YUI editor (RTE): How to wrap selection with a <span> and NOT lose formatting?

空扰寡人 提交于 2020-01-25 07:19:07
问题 Ok so I've got a problem I've been working on for the last week or so and have tried everything I know or could find. I am using YUI 2.x editor where users will be doing some heavy formatting. I have an external button on the page that needs to wrap the selected text in a <span> when the user clicks it, but it must do this without loosing any formatting. For some reason doing the following likes to erase all of the formatting in the selection: var sel = myEditor._getSelection(); var newEl = '

How to insert custom html tag using YUI Editor

不羁岁月 提交于 2019-12-23 04:12:08
问题 I've got YUI set up and working. I've created a custom button and it shows up fine. What I would like that button to do is wrap selected text with my own custom 'span' tags, just like clicking the 'bold' button wraps selected text with 'strong' / 'bold' tags. Does anyone have any examples they could point to to make this work? 回答1: Discovered the solution for myself, so I'm posting so others may see as well. :) First, a BIG thanks to MK_Dev for inspiration from his similar question asked back

How to insert custom html tag using YUI Editor

送分小仙女□ 提交于 2019-12-23 04:11:20
问题 I've got YUI set up and working. I've created a custom button and it shows up fine. What I would like that button to do is wrap selected text with my own custom 'span' tags, just like clicking the 'bold' button wraps selected text with 'strong' / 'bold' tags. Does anyone have any examples they could point to to make this work? 回答1: Discovered the solution for myself, so I'm posting so others may see as well. :) First, a BIG thanks to MK_Dev for inspiration from his similar question asked back

How to insert custom html tag using YUI Editor

时间秒杀一切 提交于 2019-12-23 04:11:11
问题 I've got YUI set up and working. I've created a custom button and it shows up fine. What I would like that button to do is wrap selected text with my own custom 'span' tags, just like clicking the 'bold' button wraps selected text with 'strong' / 'bold' tags. Does anyone have any examples they could point to to make this work? 回答1: Discovered the solution for myself, so I'm posting so others may see as well. :) First, a BIG thanks to MK_Dev for inspiration from his similar question asked back

YUI Editor: Getting rid of <html> tags in content

泄露秘密 提交于 2019-12-11 15:56:26
问题 I implemented the YUI rich text editor and I would like to get rid of the <html> , <body> and DOCTYPE tags as soon as I save the content from the editor. I know I could do this afterwards by parsing the HTML, but there must be a better solution. Right now this is saved when I edit a text in the YUI editor: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <body> <p>foo</p> </body> </html> ...but I would like to just save this: <p

YUI Editor (RTE): Insert HTML element and place cursor inside

↘锁芯ラ 提交于 2019-12-09 19:26:01
问题 I have a problem. I've been trying to tackle it for a while now and I'm ready to explode. Here's my requirement: I have an external toolbar (not part of YUI) above the editor that I want to use to insert HTML tags. The user should be able to click a link on the toolbar after which a few things may happen: If there's any selected text, this text gets wrapped into an HTML tag If there's no selected text, an empty HTML tag is inserted in the editor Regardless of the scenario, cursor MUST be