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.0] Tinymce 5.0 migration #24110

Merged
merged 65 commits into from Apr 18, 2019
Merged
Changes from 9 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0d0e5b9
First update try
bembelimen Mar 3, 2019
9571631
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into tinymce-5.0
bembelimen Mar 6, 2019
8bfa347
More TinyMCE changes
bembelimen Mar 6, 2019
76367f5
Update skin paths
bembelimen Mar 7, 2019
f6b3678
Fix broken height of editor
bembelimen Mar 7, 2019
9750aa9
Offer px instead of pt in font-size dropdown
bembelimen Mar 7, 2019
e1fdcb4
First fixes for the tinymce builder
bembelimen Mar 9, 2019
ce122a9
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into tinymce-5.0
bembelimen Mar 9, 2019
2101cb8
Remove tabs
bembelimen Mar 9, 2019
a9f3019
Add tinymce builder icons
bembelimen Mar 10, 2019
c7766c9
Clean tabs
bembelimen Mar 10, 2019
fa94a04
Clean up SCSS file for tinymce builder
bembelimen Mar 10, 2019
21b4df9
First version of dragula implementation for the tinymce builder
bembelimen Mar 14, 2019
be2085c
CS whitespaces
bembelimen Mar 14, 2019
b9ffba8
Cleanup
bembelimen Mar 14, 2019
8d3ca85
Fix wrong this context
bembelimen Mar 15, 2019
5bae398
Set the correct context for the main variables
bembelimen Mar 16, 2019
3509b47
Add correct styling to the drag & drop button
bembelimen Mar 16, 2019
7675d80
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into tinymce-5.0
bembelimen Mar 16, 2019
3e46451
Extend fancy select to enable/disable options
bembelimen Mar 16, 2019
32d772a
Implement SVG icons for editor-xtd buttons
bembelimen Mar 17, 2019
47d8ba2
Code cleanup
bembelimen Mar 17, 2019
3903f66
Adjust line length
bembelimen Mar 17, 2019
2d96fbf
Fix button calls
bembelimen Mar 17, 2019
8f9e9f5
Fix line length CS
bembelimen Mar 17, 2019
194a7c8
CS clean up
bembelimen Mar 17, 2019
480b2bb
CS clean up
bembelimen Mar 17, 2019
6486d70
Merge branch '4.0-dev' into fancy-select-option
bembelimen Mar 17, 2019
5831777
Update choices.js
bembelimen Mar 22, 2019
b3bfa55
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into fancy-sel…
bembelimen Mar 22, 2019
a27f61b
Fix choices setting paths
bembelimen Mar 22, 2019
e0a08e1
Add more lock info
bembelimen Mar 23, 2019
c524a79
Add more lock info
bembelimen Mar 23, 2019
8252ab4
Update store loader
bembelimen Mar 23, 2019
ab3f843
Merge branch '4.0-dev' into fancy-select-option
zero-24 Mar 24, 2019
946f874
Update link to the tinymce skin creator
bembelimen Apr 2, 2019
7dd0fde
Merge branch 'tinymce-5.0' of github.com:bembelimen/joomla-cms into t…
bembelimen Apr 11, 2019
c4d0fd6
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into tinymce-5.0
bembelimen Apr 11, 2019
eec6b1e
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into tinymce-5.0
bembelimen Apr 13, 2019
3983980
Update to Choices.js 7.0
bembelimen Apr 13, 2019
54dc2a3
Fix hound issues
bembelimen Apr 13, 2019
beff8fb
More hound fixes
bembelimen Apr 13, 2019
ce79859
Merge branch '4.0-dev' of github.com:joomla/joomla-cms into fancy-sel…
bembelimen Apr 13, 2019
195c6f3
Fix hound issues
bembelimen Apr 13, 2019
dc6ac20
Update package-lock.json
bembelimen Apr 14, 2019
62218d6
Merge branch 'fancy-select-option' into tinymce-5.0
bembelimen Apr 14, 2019
ce19dc3
Disable access level options when already selected.
bembelimen Apr 15, 2019
891dc28
Revert fancy select merge
bembelimen Apr 15, 2019
54ff971
Revert fancy select merge
bembelimen Apr 15, 2019
6e548c0
Fix hound issues
bembelimen Apr 15, 2019
378fe87
Fix broken code
bembelimen Apr 15, 2019
9557273
Fix hound issues
bembelimen Apr 15, 2019
5eea5d7
Fix hound issues
bembelimen Apr 15, 2019
3414eab
Fix hound issues
bembelimen Apr 15, 2019
058168d
Fix hound issues
bembelimen Apr 15, 2019
68e04f6
Fix hound issues
bembelimen Apr 16, 2019
6d5f2b9
Clean up packages
bembelimen Apr 16, 2019
0f86fb9
Clean up packages
bembelimen Apr 16, 2019
07cc7db
Merge branch '4.0-dev' into tinymce-5.0
bembelimen Apr 16, 2019
dadfbf7
Merge branch '4.0-dev' into tinymce-5.0
bembelimen Apr 16, 2019
65b9bce
Fix version string
bembelimen Apr 16, 2019
bf9e962
Merge branch 'tinymce-5.0' of github.com:bembelimen/joomla-cms into t…
bembelimen Apr 16, 2019
632ed26
Hound fix
bembelimen Apr 16, 2019
3a9a848
Merge branch '4.0-dev' into tinymce-5.0
jeckodevelopment Apr 17, 2019
f44f5e0
Set version string hard coded
bembelimen Apr 17, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -38,7 +38,7 @@ PLG_TINY_FIELD_RESIZE_HORIZONTAL_LABEL="Horizontal Resizing"
PLG_TINY_FIELD_RESIZING_LABEL="Resizing"
PLG_TINY_FIELD_SETACCESS_LABEL="Assign this Set to"
PLG_TINY_FIELD_SKIN_ADMIN_LABEL="Administrator Skin"
PLG_TINY_FIELD_SKIN_INFO_DESC="Copy your new skins to: /media/editors/tinymce/skins."
PLG_TINY_FIELD_SKIN_INFO_DESC="Copy your new skins to: /media/editors/tinymce/skins/ui."
PLG_TINY_FIELD_SKIN_INFO_LABEL="For customised skins go to: <a href=\"http://skin.tinymce.com\" target=\"_blank\">Skin Creator</a>"
This conversation was marked as resolved by bembelimen

This comment has been minimized.

Copy link
@brianteeman

brianteeman Mar 29, 2019

Contributor

the link has changed and is now http://skin.tiny.cloud/

This comment has been minimized.

Copy link
@bembelimen

bembelimen Apr 2, 2019

Author Contributor

Thx

PLG_TINY_FIELD_SKIN_LABEL="Site Skin"
PLG_TINY_FIELD_URLS_LABEL="URLs"
@@ -226,9 +226,9 @@ const copyFiles = (options) => {
Fs.writeFileSync(`${RootPath}/plugins/editors/tinymce/tinymce.xml`, tinyXml, { encoding: 'UTF-8' });

// Remove that sourcemap...
let tinyWrongMap = Fs.readFileSync(`${RootPath}/media/vendor/tinymce/skins/lightgray/skin.min.css`, { encoding: 'UTF-8' });
let tinyWrongMap = Fs.readFileSync(`${RootPath}/media/vendor/tinymce/skins/ui/oxide/skin.min.css`, { encoding: 'UTF-8' });
tinyWrongMap = tinyWrongMap.replace('/*# sourceMappingURL=skin.min.css.map */', '');
Fs.writeFileSync(`${RootPath}/media/vendor/tinymce/skins/lightgray/skin.min.css`, tinyWrongMap, { encoding: 'UTF-8' });
Fs.writeFileSync(`${RootPath}/media/vendor/tinymce/skins/ui/oxide/skin.min.css`, tinyWrongMap, { encoding: 'UTF-8' });
} else {
['js', 'css', 'filesExtra'].forEach((type) => {
if (!vendor[type]) return;
@@ -64,9 +64,9 @@
var $copyHelper = null, removeIntent = false, self = this;
this.$sourceMenu.sortable({
connectWith: this.$targetMenu,
items: '.mce-btn',
items: '.tox-mbtn',
cancel: '',
placeholder: 'mce-btn ui-state-highlight',
placeholder: 'tox-mbtn ui-state-highlight',
start: function(event, ui) {
self.$targetMenu.addClass('drop-area-highlight');
},
@@ -82,9 +82,9 @@

this.$sourceToolbar.sortable({
connectWith: this.$targetToolbar,
items: '.mce-btn',
items: '.tox-mbtn',
cancel: '',
placeholder: 'mce-btn ui-state-highlight',
placeholder: 'tox-mbtn ui-state-highlight',
start: function(event, ui) {
self.$targetToolbar.addClass('drop-area-highlight');
},
@@ -99,9 +99,9 @@
});

$().add(this.$targetMenu).add(this.$targetToolbar).sortable({
items: '.mce-btn',
items: '.tox-mbtn',
cancel: '',
placeholder: 'mce-btn ui-state-highlight',
placeholder: 'tox-mbtn ui-state-highlight',
receive: function(event, ui) {
$copyHelper = null;
var $el = ui.item, $cont = $(this);
@@ -189,12 +189,15 @@
'class': 'mce-btn',
'data-name': name,
'data-toggle': 'tooltip',
'title': tinymce.translate(info.label)
'title': tinymce.translate(info.label),
});
var $btn = $('<button/>', {
'type': 'button'
'type': 'button',
'data-name': name,
'class': 'tox-mbtn tox-mbtn--select',
'data-toggle': 'tooltip',
'title': tinymce.translate(info.label),
});
$element.append($btn);

if (type === 'menu') {
$btn.html('<span class="mce-txt">' + tinymce.translate(info.label) + '</span> <i class="mce-caret"></i>');
@@ -203,7 +206,7 @@
$btn.html(info.text ? tinymce.translate(info.text) : '<i class="mce-ico mce-i-' + name + '"></i>');
}

return $element;
return $btn;
};

/**
@@ -69,11 +69,11 @@
tmp.icon = xtdButton.icon;

if (xtdButton.href) {
tmp.onclick = () => {
tmp.onAction = () => {
document.getElementById(`${xtdButton.id}Modal`).open();
};
} else {
tmp.onclick = () => {
tmp.onAction = () => {
// eslint-disable-next-line no-new-func
new Function(xtdButton.click)();
};
@@ -84,11 +84,11 @@

if (buttonValues.length) {
options.setup = (editor) => {
editor.addButton('jxtdbuttons', {
editor.ui.registry.addButton('jxtdbuttons', {
type: 'menubutton',
text: Joomla.JText._('PLG_TINY_CORE_BUTTONS'),
icon: 'none icon-joomla',
menu: buttonValues,
fetch: callback => callback(buttonValues),
});
};
}
@@ -16,15 +16,15 @@
margin-bottom: 20px;
clear: both;
}
.mce-panel .drop-area-highlight {
#joomla-tinymce-builder .drop-area-highlight {
background-color: #d0d0d0;
}
.mce-panel .mce-btn.ui-state-highlight {
#joomla-tinymce-builder .tox-mbtn.ui-state-highlight {
height: 28px;
width: 40px;
background-color: #409740;
border: 1px solid #f0f0f0;
}
.timymce-builder-toolbar .mce-btn.ui-state-highlight {
.timymce-builder-toolbar .tox-mbtn.ui-state-highlight {
height: 22px;
}
@@ -57,7 +57,7 @@
HTMLHelper::_('behavior.core');
HTMLHelper::_('jquery.ui', array('core', 'sortable'));
HTMLHelper::_('stylesheet', 'media/vendor/tinymce/skins/lightgray/skin.min.css', array('version' => 'auto', 'relative' => false));
HTMLHelper::_('stylesheet', 'media/vendor/tinymce/skins/ui/oxide/skin.min.css', array('version' => 'auto', 'relative' => false));
HTMLHelper::_('stylesheet', 'plg_editors_tinymce/tinymce-builder.css', array('version' => 'auto', 'relative' => true));
HTMLHelper::_('script', 'plg_editors_tinymce/tinymce-builder.js', array('version' => 'auto', 'relative' => true));
@@ -80,17 +80,15 @@

<p><?php echo Text::_('PLG_TINY_SET_SOURCE_PANEL_DESCRIPTION'); ?></p>

<div class="mce-tinymce mce-container mce-panel">
<div class="mce-container-body mce-stack-layout">
<div class="tox tox-tinymce">
<div class="tox-editor-container">

<div class="mce-container mce-menubar mce-toolbar mce-stack-layout-item">
<div class="mce-container-body mce-flow-layout timymce-builder-menu source" data-group="menu"
data-value="<?php echo $this->escape(json_encode($menubarSource)); ?>">
</div>
<div class="tox-menubar timymce-builder-menu source" data-group="menu"
data-value="<?php echo $this->escape(json_encode($menubarSource)); ?>">
</div>

<div class="mce-toolbar-grp mce-container mce-panel mce-stack-layout-item">
<div class="mce-container-body mce-flow-layout timymce-builder-toolbar source" data-group="toolbar"
<div class="tox-toolbar">
<div class="timymce-builder-toolbar source" data-group="toolbar"
data-value="<?php echo $this->escape(json_encode($buttonsSource)); ?>">
</div>
</div>
@@ -167,17 +165,17 @@
</div>
</div>

<div class="mce-tinymce mce-container mce-panel">
<div class="mce-container-body mce-stack-layout">
<div class="mce-container mce-menubar mce-toolbar timymce-builder-menu target"
<div class="tox tox-tinymce">
<div class="tox-editor-container">
<div class="tox-menubar timymce-builder-menu target"
data-group="menu" data-set="<?php echo $num; ?>"
data-value="<?php echo $this->escape(json_encode($valMenu)); ?>">
</div>
<div class="mce-toolbar-grp mce-container mce-panel timymce-builder-toolbar target"
<div class="tox-toolbar timymce-builder-toolbar target"
data-group="toolbar1" data-set="<?php echo $num; ?>"
data-value="<?php echo $this->escape(json_encode($valBar1)); ?>">
</div>
<div class="mce-toolbar-grp mce-container mce-panel timymce-builder-toolbar target"
<div class="tox-toolbar timymce-builder-toolbar target"
data-group="toolbar2" data-set="<?php echo $num; ?>"
data-value="<?php echo $this->escape(json_encode($valBar2)); ?>">
</div>

Some generated files are not rendered by default. Learn more.

@@ -42,7 +42,7 @@
"metismenujs": "^1.0.3",
"popper.js": "^1.14.3",
"punycode": "1.4.1",
"tinymce": "4.8.3"
"tinymce": "~5.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
@@ -34,7 +34,7 @@ public function getOptions()
{
$options = array();
$directories = glob(JPATH_ROOT . '/media/vendor/tinymce/skins' . '/*', GLOB_ONLYDIR);
$directories = glob(JPATH_ROOT . '/media/vendor/tinymce/skins/ui' . '/*', GLOB_ONLYDIR);
for ($i = 0, $iMax = count($directories); $i < $iMax; ++$i)
{
@@ -7,6 +7,7 @@
multiple="true"
class="access-select"
labelclass="badge badge-success"
layout="joomla.form.field.list-fancy-select"
/>

<field
@@ -47,7 +47,7 @@ class PlgEditorTinymce extends CMSPlugin
/**
* Loads the application object
*
* @var JApplicationCms
* @var \Joomla\CMS\Application\CMSApplication
* @since 3.2
*/
protected $app = null;
@@ -161,7 +161,7 @@ public function onDisplay(
$user = Factory::getUser();
$language = Factory::getLanguage();
$theme = 'modern';
$theme = 'silver';
$ugroups = array_combine($user->getAuthorisedGroups(), $user->getAuthorisedGroups());
// Prepare the parameters
@@ -192,10 +192,10 @@ public function onDisplay(
$levelParams->loadObject($extraOptions);
// List the skins
$skindirs = glob(JPATH_ROOT . '/media/vendor/tinymce/skins' . '/*', GLOB_ONLYDIR);
$skindirs = glob(JPATH_ROOT . '/media/vendor/tinymce/skins/ui' . '/*', GLOB_ONLYDIR);
// Set the selected skin
$skin = 'lightgray';
$skin = 'oxide';
$side = $app->isClient('administrator') ? 'skin_admin' : 'skin';
if ((int) $levelParams->get($side, 0) < count($skindirs))
@@ -344,6 +344,16 @@ public function onDisplay(
$html_width = '';
}
if (is_numeric($html_width))
{
$html_width .= 'px';
}
if (is_numeric($html_height))
This conversation was marked as resolved by bembelimen

This comment has been minimized.

Copy link
@wilsonge

wilsonge Mar 9, 2019

Contributor

Instead of this just force it to an int. That worked for me

This comment has been minimized.

Copy link
@bembelimen

bembelimen Mar 10, 2019

Author Contributor

I know, but that eliminates the possibility to add "%".

This comment has been minimized.

Copy link
@wilsonge

wilsonge Mar 13, 2019

Contributor

Stick with what we had working. Then we can build feature enhancements

{
$html_height .= 'px';
}
// The param is true for vertical resizing only, false or both
$resizing = (bool) $levelParams->get('resizing', true);
$resize_horizontal = (bool) $levelParams->get('resize_horizontal', true);
@@ -358,7 +368,6 @@ public function onDisplay(
'autolink',
'lists',
'save',
'colorpicker',
'importcss',
);
@@ -455,7 +464,7 @@ public function onDisplay(
}
// Check for extra plugins, from the setoptions form
foreach (array('wordcount' => 1, 'advlist' => 1, 'autosave' => 1, 'contextmenu' => 1) as $pName => $def)
foreach (array('wordcount' => 1, 'advlist' => 1, 'autosave' => 1) as $pName => $def)
{
if ($levelParams->get($pName, $def))
{
@@ -506,6 +515,9 @@ public function onDisplay(
$scriptOptions['uploadUri'] = $uploadUrl;
}
// Convert pt to px in dropdown
$scriptOptions['fontsize_formats'] = '8px 10px 12px 14px 18px 24px 36px';
// User custom plugins and buttons
$custom_plugin = trim($levelParams->get('custom_plugin', ''));
$custom_button = trim($levelParams->get('custom_button', ''));
@@ -945,8 +957,6 @@ public static function getKnownButtons()
'removeformat' => array('label' => 'Clear formatting'),
// Buttons from the plugins
'forecolor' => array('label' => 'Text color', 'plugin' => 'textcolor'),
'backcolor' => array('label' => 'Background color', 'plugin' => 'textcolor'),
'anchor' => array('label' => 'Anchor', 'plugin' => 'anchor'),
'hr' => array('label' => 'Horizontal line', 'plugin' => 'hr'),
'ltr' => array('label' => 'Left to right', 'plugin' => 'directionality'),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.