How to retain style tags saved in the contents in JCE? - joomla

On my Joomla 3.3.0 site, I'm trying to write custom css rules in my article editor (JCE 2.3.4.4). I have disabled the 'html filtering' and now this is possible.
So now I get the desired output when I write something like:
<p>test</p>
<style>#t123{color:red}</style>
<div id="t123">red font</div>
However when I try to edit the article again, the style tag is missing. I can only see:
<p>test</p>
<div id="t123">red font</div>
How can I configure the editor to also show the style tag when editing?

There are two places where you need to disable filtering. One is the Global Configuration -> Text Filtering and another is JCE Editor Profiles -> Plug-in Parameters -> Media Support.

The answer to my question is to enable the Allow CSS option in Components > JCE Editor > Editor Profiles > Editor Parameters > Advanced
Thanks to #Apurv for giving me a hint on where to look for

Related

How to "Paste as plain text" by default in Joomla 3.8 TinyMce editor?

As the title says, I need to make this default as users are pasting terribly formatted text to the editor.
I have read similar threads where it says I should add some code to TinyMCE.init section in the file \plugins\editors\tinyMCE\tinymce.php, but there is no such section in this file.
BR,
Martin
You will indeed need to set the paste_as_text option to true in your .init. You can read more about the options for the paste plugins here: https://www.tinymce.com/docs/plugins/paste/
I've been reviewing the TinyMCE 4 configuration documentation and searching the Joomla! where to change these parameters:
[https://www.tiny.cloud/docs/plugins/paste/#paste_as_text][1]
Although the plugin does not offer these options in the settings, I was able to edit directly in the file code.
sitejoomla/plugins/editors/tinymce/tinymce.php
At approximately lines 652, look for 'paste_data_images' and add the parameter to paste in plain text as below:
'paste_data_images' => $ allowImgPaste,
'paste_as_text' => true,
Now by default when pasting (Ctrl + v) in the editor the text will be cleared without html tags and other dirt code from where it copied.
Test version of tools
Joomla! 3.9.x
Editor - TinyMCE - 4.5.x 2005-2019

Ckeditor allowedContent with rules

I am trying to use allowedContent in the main config file to allow the inclusion of the class attribute for divs when in source editor mode.
I have tried
config.allowedContent='div[class]';
And for some this has the effect of removing some but not all of the toolbar options and also does not allow the inclusion of the class attribute.
There are no errors found on the debug inspector.
If I do
config.allowedContent=true;
This works as expected but I don't want to allow all content.
The toolbar options left are, full screen, source and format. That is from a custom selection.
If you want to allow any class use the following: config.allowedContent='div(*)'.
More on that you'll find in CKEditor docs
config.extraAllowedContent='div(*)';
For whatever reason using this method works.

Joomla JCE editor removes <canvas> element on save

I use html 5 canvas with some javascript in joomla articles - JCE editor.
When I save the article, the editor removes the canvas element, only javascript remains.
I disabled all cleanup in jce:
Editor global configuration: validate html: no
Editor profiles -> Default -> Editor Parameters -> Cleanup & Output: Validate html: no
In Advanced options all is allowed (javascript, css, php, xhtml)
Joomla text filter: no filtering
and JCE stil removes this canvas line:
<canvas id="name" width="1170" height="400"></canvas>
I currently use Sourcerer plugin, but I don't like it because no code is highlighted.
Joomla 3.4, JCE 2.4.6
Try the following.
Go to
Extensions >> Plugin Manager >> TinyMCE >> Valid Elements
The add canvas to the textarea.

Can't change the word on a button on Magento

I have installed a cookie bar extension via Magento Connect and it works just fine. I want now to change the text inside the that says "Close".
I have written it in the translation files, cleaned my cache and nothing happened.
I have also read this and tried to find the button on the extension's files, but I can't find it.
Anyone has more ideas of how to solve this issue or point me to a solution? Thanks in advance!
UPDATE
I am using this extension
Image of the issue:
To create translate you need to follow below steps :
Place your language package in /app/locale directory.
Now got to Admin c-panel > System > Configuration > General > Locale Options > Locale select you language pack from the Dropdown list.
you can also translate the words through Inline. Go to System > configuration > Developers > Translate Inline. After enabling this you can translate directly through UI

Integrated Markdown WYSIWYG text editor

In looking for a straightforward WYSIWYG editor for Markdown code, I am not finding a comparible UI to that of CkEditor, TinyMCE, ect.
Specifically, the Markdown "WYSIWYG" editors that are often recommended (such as posts like this ) are not pure WYSIWYG editors in the sense that users either still write raw Markdown ( MarkItUp ) or go to the other extreme of having in-line editing without standard controls ( Hallo ).
I need something in-between.
I'm looking for a Markdown editor that looks and functions like a stripped down CkEditor text box, and that accepts and outputs Markdown. There should be a toolbar with a minimum set of formatting options (B, I, U, lists, ect), and the text entry area should show the converted Markdown, not the raw code. There should be a Source button that will allow users to edit the raw Markdown, but even that is optional. Ex:
I get the reason for Markdown/wiki, ect - the security it offers. I don't mind entering raw code like here at SE, but my users are not geeks and do not find this enjoyable. They don't want to see * * * ___ and spaces mixed in with their text. They are used to "Word" style editing, and are most productive in that environment.
So - is there a truly integrated WYSIWYG editor for Markdown? I'm writing in a PHP, so something that I can invoke with a class would be perfect.
Sept 23, 2015 Update
CKEditor now has a Markdown addon that does this exact thing. The addon project is hosted on github.
Screenshots:
Apr 13, 2015 Update
Someone professing to develop CKEditor says that the appearance of CommonMark is a game changer, and we could possibly see a proper markup interface for CKEditor (read comments for the full story).
Feb 6, 2015 Update
CKEditor now comes with a plugin that outputs (and accepts as input) BBCode.
Demo: http://ckeditor.com/demo#bbcode
SimpleMDE, a newcomer, may be the answer. I've been searching for something just like this for a month now. I'm surprised that this does not show up higher in search results. I had to go through a notice on lepture/editor to find this.
I was researching in this subject the other day and I haven't found any decent WYSIWYG editor with Markdown output. In fact, first you have to have to create a WYSIWG Markdown editor is WYSIWG HTML editor and there are just few of them that are usable on the market.
There's a chance that you'll be able to create dataProcessor for CKEditor that will change HTML editor into Markdown editor. We've got a plugin for BBCode that works like this (check out http://nightly-v4.ckeditor.com/3737/samples/bbcode.html).
All you have to do is implement this interface http://nightly-v4.ckeditor.com/ckeditor_api/#!/api/CKEDITOR.dataProcessor. If you check BBCode plugin's code you'll see some hacks and tricks, because unfortunately current CKEditor's architecture isn't ready (yet) to create such a data processor. However, I believe that if you want to provide only few styling options you should be able to implement Markdown support pretty quickly.
EDIT Sept 23, 2015
CKEditor now has a Markdown addon that does this exact thing. The addon project is hosted on github.
Screenshots:
As posted in my Feb 6, 2015 update, CKEditor now includes plugins that allow BBCode input and output.
A demo is available here: http://ckeditor.com/demo#bbcode
EDIT Apr 13, 2015:
Someone professing to develop CKEditor says that the appearance of CommonMark is a game changer, and we could possibly see a proper markup interface for CKEditor (read comments for the full story).
Pen is a new (active as of 2014) WYSIWYG editor that outputs Markdown.
It's not perfect—I've had issues with pasting HTML there—but it works.
Edit: Sorry! It doesn't output Markdown. Walery Strauch pointed out in the comments that the Markdown formatting signs I saw were actually CSS pseudo element rules:
Still, I'll leave it here as an option since some people upvoted this answer and it may have been of use to somebody.
I implemented a very simple editor that allows the contents of a <textarea> that contains Markdown to be edited in a WYSIWYG fashion.
I used Hallo. I don't think its web site makes it obvious that it is not itself a Markdown WYSIWYG editor but the demo does forge the path to one.
Hallo allows WYSIWYG editing of the HTML inside a <div>. I used javascript to hide any <textarea> blocks that have a specific wysiwyg CSS class, replacing it with a <div> and copying the contents of the <textarea> into the <div>. The copying runs through Showdown which produces HTML from Markdown.
Another Javascript routine reacts every time the <div> contents change. It copies the contents back into the (now hidden) <textarea>. The content is run through to-markdown to convert from HTML to Markdown.
If the <textarea> is a field in a <form>, then the edited Markdown will be sent to the server when that form is submitted.
The inspiration for this comes from the Hallo Markdown Example, specifically the editor.js file. I used that as a basis for my own script along with hallo.js, showdown.js and to-markdown.js.
My script, wysiwyg.js is a derivative of editor.js from the Hallo Markdown Example. Some points to note:
I use this in a Rails application (not that that matters)
It runs on ready and also on page:load, the latter because Rails uses Turbolinks
It runs on ajaxComplete because I use Ajax for form error reports
There are other dependencies: JQueryUI and Rangy (Rails users can avail of the gems jquery-ui-rails and rangy-rails).
Also Font Awesome is used for the tool bar icons. The version of hallo.js used by the demo is out of date (it uses an old version of Font Awesome) - use hallo.js from GitHub instead.
You only need to add CSS class='wysiwyg' to any <textarea> to enable WYSIWYG on it. The <textarea> should conain Markdown formatted text.
I would expect that wysiwyg.js could be easily adapted to use another editor if you don't like Hallo as long as it works on the HTML in a <div>. There are quite a few to choose from but not all are as lightweight as Hallo.
A smilar piece of work that I found is markdown-html-form. It uses the same Showdown and to-markdown.
I am also looking for a markdown editor that is described at the top of this thread
Have you seen "markdown tools": http://md-wysiwyg.sourceforge.net/
Demo: http://md-wysiwyg.sourceforge.net/cgi-bin/cgi_wysiwyg_test.py/
That seems pretty close to what we are looking for, it does a reasonable job of taking your WYSIWYG rich text and outputting markdown. However it failed on an encoding exception when I pasted in some rich text from a google doc.
I found two which currently seem to be quite popular, active and free but haven't been mentioned yet.
The first one is Toast UI Editor. It supports both modes (WYSIWYG and raw). It has official react and vuejs wrappers.
The second one is ProseMirror which calls itself "a toolkit for building rich-text editors on the web" and it seems to be very flexible and extensive. It also supports both modes.
I'm pretty sure solid unofficial react / vue / angular wrappers for it can be found as well.

Resources