Needs review
Project:
CKEditor Widgets
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2015 at 19:36 UTC
Updated:
15 Mar 2017 at 22:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
azinck commentedI haven't looked at the angular component of this project at all because I am not using it. I attempted to identify the settings where null might be a meaningful value and only change those, but I probably missed some. Works for my use-case. With this patch you can totally disable the allowed content filter on these widgets by implementing something like:
Comment #3
azinck commentedComment #4
thejimbirch commentedApplying the patch failed for me. There have been some changes in /plugins/widgetbootstrap/plugin.js
I manually changed the code and I believe it works as desired.
Added a couple other settings to your custom module code:
Comment #5
dimilias commentedJust if someone searches about it, and also because these solutions did not help my case, what I did which helped was:
- I downloaded the dev versions of ckeditor and ckeditor_widgets (though I think that normal versions are fine too).
- Followed instructions about setting up the widgets.
- Common widgets did not work for me so I disabled them from the menu (through the ckeditor_widgets admin settings page)
- In my case, I disabled the ACF because there are like 3 people that edit the pages so I did not need it but following instructions about allowed content it still works. Personally my preferred setup is editing the advanced settings in ckeditor and add
(The second one helped me with the editor removing empty i tags because some icons are in the form of
The first one actually disables the ACF but you can ignore this and add the tags you wish to the extra allowed content.
But just to say, I also needed to implement the hook from #4 otherwise I still cannot make it work.
Now the different thing from all the other comments:
On the instructions of the ckeditor_widgets, it mentions to download the ckeditor with the widget plugin.
Issue is, if you use the builder in ckeditor, it provides you the optimized version. The widget plugin is missing a plugin.js file when downloaded as optimized.
I downloaded the full version of ckeditor with the widgets (in order not to miss any dependencies) but then downloaded the widget unoptimized. Then in the Editor appearance, I exclusively enabled the Widgets plugin file.
This actually enabled the buttons for me in the editor.
Some (out of scope maybe) troubleshooting:
Sometimes the ckeditor was missing some bootstrap icons and the whole editor did not appear. If this is the case, you need to copy the icons from the ckeditor_widgets to your plugin directory.
Do not copy the entire folders because there will be conflicts. In the end, in the plugin directory there should be the folders widgetbootstrap, widgetcommon and widgettemplatemenu and within these folders there should be the icons folder copied from the corresponding from the ckeditor_widgets.
There is always a good practice, if something is not working, to start from scratch! so when things get bad, you should go and disable everything from the editor and start adding one my one. The same issue with the widgets plugin, seems to solve just a few other issues for other buttons as well (by downloading the full plugin and enabling it from the editor appearance).
If I'm doing something wrong please let me know.
NOTICE: The above solution does not seem to work for ckeditor 4.5.9! It worked until 4.5.8.
Edit: My solution for the 'i' tag is again not working.. Will have to check this a bit more.
Edit 2: Regarding the 'i' tags, what worked from me is adding the line
CKEDITOR.config.protectedSource.push(/<i[\s\S]*?>[\s\S]*?<\/i>/gi);to my ckeditor.config.js file. You can do it in the ckeditor module's ckeditor.config.js file or in the theme's or even add your own. Remember to clear your cache. Also, use with CAUTION. The above settings allow everything to be added to you 'i' tag. You must use a different regex pattern to narrow it down.
Edit 3: You might also want to use span instead of 'i' tags to show icons.
Anyway, my bad, the solution indeed worked. My first edit is wrong, the configuration indeed worked for me. Adding to my ckeditor the
CKEDITOR.dtd.$removeEmpty.i = 0;did the trick indeed. I also added the same for span. You would prefer this over the edit 2 solution, because the 'protectedSource' actually disables the text from being visible outside the source (i.e. if you are writting php code in there). Instead, setting remove to 0, just prevents it from removing it. This is because i is also used for italic along with the em tag.
Comment #6
ujin commentedHello Guys, I have tried the options in this thread, but still if I add to the column in the template list or try to change color of the text after saving the content it disappearing, but if outside of the column works fine. Even if I just do disable enable rich text format it strips all the code except
element, is it possible somehow to add elements inside columns?
Please advice.
Thanks!
Comment #7
ikeigenwijs commentedI have custom budgets in bootstrap widget.
But the internal text and markup keeps getting stript on every edit, even the simple
in global ckeditor the filtering is turned off
I re-rolled the patch