Add attribute to detected keywords in ACE editor - ace-editor

I created a custom mode in ace editor for a custom markup I have in my app (which works great). I'd like to add a contentEditable=false for all the detected keywords.
Indeed, ace editor adds a <span class="ace-keyword"> xxxx </span> around the keywords but I need to add attributes to these spans. I have no idea where this should be done. Any insights?
Cheers

Related

CKEditor delete Format combobox

When I delete the Format combobox in toolbar, CKEditor deletes my own formatting.
I would like to use formatting as separate buttons. Is that even possible?
CKEditor by default has some filter rules, which prevent of having trash in output HTML.
When you add a plugin, then such plugin usually register set of rules which are necessary for its work. E.g. When you add an image plugin then <img> tags starts to be allowed in editor contents.
So when you remove formatting plugin, then most probably you also remove those filtering rules. That's why your formatting is removed from the editor. You can add your own custom rules with: extraAllowedContent.
I don't know how are you going to add separate buttons with formatting, but in case of creating your own plugin you can also register proper filter rules inside your plugin code.

Work in 'source mode' but enable toolbar buttons

I am building a simple forum on my website using CKEditor as a BBCode editor. I managed to make CKEditor output BBCode just fine by following the example.
However, I do not want to use the 'WYSIWYG' interface. I just want a plain "bbcode source" editor. The WYSIWYG output is not exactly the same as how the output will look on my forum (because I translate the bbcode to html myself and then apply some additional styling) and I don't really like the difference. More importantly, I have a couple "custom bbcode" tags that make no sense outside of my forum and obviously CKEditor doesn't know what to do with them, so I get a mix of bbcode and WYSIWYG output which looks odd.
I can force the CKEditor into 'source mode' by setting the startupMode and removing the source button, but when I do that it disables the entire toolbar!
I want to work in source mode, but still use the various buttons like B, I, etc. When such a button is pressed I just want it to insert the [b] [/b] tags for example around the selected text.
This is pretty much how every forum I've ever seen works, but I can't figure out how to configure CKEditor to do this.
Unfortunately it's impossible. Most of the plugins require WYSIWYG mode and don't work without it.
However you could try to control the output of the editor and change it according to your needs by adjusting editor's filter or implementing custom data processor.

Font-awesome codes overrided by toggle editor

I am editing an article and adding FontAwesome in it using Toggle Editor. I've found out that when I add the code using programmer view, it works fine. However, when I change to the designer view from the programmer view, the editor automatically edit the code like this:
Before:
After clicking "Toggle Editor":
It is quite inconvenient for me because I use the designer view to style the article frequently. Is there any solution for it?
You'll have to look into the allowed tags for the editor you're using.
In your case using JCK Editor - you can see this article on why it removes certain code
At first glance it appears there are whitelist & blacklists for some HTML. You'll probably be able to add your selectors to the whitelist and they will no longer get stripped.

Joomla editor plugin development

I'm trying to make a plugin for each administration page with editor fields i.e. on the new article page or the new category page.
I'm not sure how exactly I should arrange this. It is a must that the triggers already exist i.e. I don't want to edit any template files.
So I have to use one of these then:
system type
content type
editors type
editors-xtd type
Where should I put this plugin? A system plugin might work but then the plugin gets triggered on each page which I find not the best
The content type won't get triggered at all.
The Editors type doesn't work either.
The editors-xtd works but it wants a button back as a return vale and I dont have a button because the plugin is mostly javascript based and automatic
What else can I use?
Thanks
Even though you're talking about a plugin, if you're talking about the editor field Joomla has it built in using JForm:
XML
<field name="test1"
label ="Test Field"
type="editor"
width="300"
filter="safehtml"
/>
(Note: editor, not editors) See this link for more information. Also, looks like this page was just put up yesterday - probably also has more information that could be useful since it sounds like a component may be more useful to you than a plugin.

CKEditor plugin rendering different in WYSIWYG and source mode

I'm starting to develop a plugin for CKEditor that needs to be used to insert some HTML snippets in a web page. This is done. Nonetheless I also need to include some special items when switching to WYSIWYG mode (e.g. something more or less similar to Show Blocks plugin, but not just using styles since I need some elements included in there). So my question is :
How could I include extra items or styles (e.g. to hide parts of the contents in WYSIWYG mode) in WYSIWYG view without altering HTML output ?
If someone could provide some information about a working (maybe simple) example, I'd also appreciate your help.
PS: If you need to know further details please ask, but for instance assume inserted raw HTML code is
<div class="xxx">Hello world !</div>
... but in WYSIWYG mode need to display a link on top of it that pops up an alert and toggles dotted border.
About injecting CSS classes in WYSIWYG mode, use addCss function.
About creating fake elements in WYSIWYG mode ... I think I can solve the problem using context menu instead.

Resources