I use CKEditor with a BBCode plugin and I need to add custom tags, for example a spoiler tag, and the other is to provide a link to the site’s user profile.
The spoiler tags will work like blockquote tags: clicking a button and getting the code. I copied blockquote/plugin.js and changed all blockquote/plugin.js lines to spoiler and quote to spoil . Then I added extraPlugins: 'spoiler' to the configuration and the toolbar button. It displays correctly, but it generates the wrong code.
For example, if I clicked on the blockquote button after selecting the text, the following code is generated:
[quote]some text[/quote]
but when I click the new button, I get the following code:
<p> <spoiler> <p> !!!</p> </spoiler></p>
So this will not work.
I would also like to create a button to link to the user. It should work as follows: after clicking the button, a dialog box appears with a search field (AJAX is not a problem), and the result is a list of users; when the user is selected and the OK button is pressed, he will generate a code of the following form:
[user=1]Admin[/user]
1 - user identifier, Admin - his name.
user1367567
source share