Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1] TinyMCE option to initially paste text without formatting #36328

Merged
merged 10 commits into from
Jan 10, 2022
1 change: 1 addition & 0 deletions administrator/language/en-GB/plg_editors_tinymce.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ PLG_TINY_FIELD_LANGCODE_LABEL="Language Code"
PLG_TINY_FIELD_LANGSELECT_LABEL="Automatic Language Selection"
PLG_TINY_FIELD_NEWLINES_LABEL="New Lines"
PLG_TINY_FIELD_NUMBER_OF_SETS_LABEL="Number of Sets"
PLG_TINY_FIELD_PASTE_AS_TEXT_LABEL="Paste As Text"
PLG_TINY_FIELD_PATH_LABEL="Element Path"
PLG_TINY_FIELD_PROHIBITED_LABEL="Prohibited Elements"
PLG_TINY_FIELD_RESIZE_HORIZONTAL_LABEL="Horizontal Resizing"
Expand Down
11 changes: 11 additions & 0 deletions plugins/editors/tinymce/forms/setoptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,17 @@
<option value="1">JON</option>
</field>

<field
name="paste_as_text"
type="radio"
label="PLG_TINY_FIELD_PASTE_AS_TEXT_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
>
<option value="0">JOFF</option>
<option value="1">JON</option>
</field>

<field
name="sourcecode"
type="radio"
Expand Down
16 changes: 9 additions & 7 deletions plugins/editors/tinymce/src/PluginTraits/DisplayTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Plugin\Editors\TinyMCE\PluginTraits;

\defined('_JEXEC') or die();
Expand All @@ -27,11 +28,11 @@
*/
trait DisplayTrait
{
use GlobalFilters;
use KnownButtons;
use ResolveFiles;
use ToolbarPresets;
use XTDButtons;
use GlobalFilters;
use KnownButtons;
use ResolveFiles;
use ToolbarPresets;
use XTDButtons;

/**
* Display the editor area.
Expand Down Expand Up @@ -454,8 +455,9 @@ public function onDisplay(

// Cleanup/Output
'browser_spellcheck' => true,
'entity_encoding' => $levelParams->get('entity_encoding', 'raw'),
'verify_html' => !$ignore_filter,
'entity_encoding' => $levelParams->get('entity_encoding', 'raw'),
'verify_html' => !$ignore_filter,
'paste_as_text' => (bool) $levelParams->get('paste_as_text', false),

'valid_elements' => $valid_elements,
'extended_valid_elements' => implode(',', $elements),
Expand Down
1 change: 1 addition & 0 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
class PlgEditorTinymce extends CMSPlugin
{
use DisplayTrait;

/**
* Base path for editor files
*
Expand Down