Skip to content

Commit

Permalink
Merge pull request #496 from percussion/tiny5
Browse files Browse the repository at this point in the history
Tiny5
  • Loading branch information
natechadwick committed Apr 1, 2022
2 parents 1608373 + e27a128 commit dbee0a0
Show file tree
Hide file tree
Showing 11 changed files with 680 additions and 807 deletions.
1 change: 0 additions & 1 deletion .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
/*
* Percussion CMS
* Copyright (C) 1999-2020 Percussion Software, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* Mailing Address:
*
* Percussion Software, Inc.
* PO Box 767
* Burlington, MA 01803, USA
* +01-781-438-9900
* support@percussion.com
* https://www.percussion.com
*
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>
*/

function percTinyMceInitialized(tinymceEditor) {

Expand Down Expand Up @@ -87,9 +64,9 @@ function buildEditorUrl(itemObject, itemJcrPath) {
itemId = itemObject.id;
itemName = itemObject.name;
itemPath = encodeURIComponent(itemJcrPath);
itemView = (itemObject.type === 'percPage') ? 'editor' : 'editAsset';
itemView = (itemObject.type == 'percPage') ? 'editor' : 'editAsset';

url = "/cm/app?view=${itemView}&mode=readonly&id=${itemId}&name=${itemName}&path=${itemPath}";
url = `/cm/app?view=${itemView}&mode=readonly&id=${itemId}&name=${itemName}&path=${itemPath}`;

return url;

Expand All @@ -104,7 +81,7 @@ function mergeConfig(options, url) {
var config = {};
var css_path = options.content_css;
var external_plugins = options.external_plugins;
if (Array.isArray(data)) {
if ($.isArray(data)) {
$.each(data, function(i, item) {
if (
(!item.hasOwnProperty('roles') || $(options.userRoles).not(item.roles).length < $(options.userRoles).length) &&
Expand All @@ -114,12 +91,12 @@ function mergeConfig(options, url) {
config = $.extend({},config,item);
}
});
} else if (data) {
} else if (data != null) {
config = data;

}

if (config)
if (config!=null)
{
if (config.hasOwnProperty('content_css')) {
config.content_css = css_path + "," + config.content_css;
Expand All @@ -138,7 +115,8 @@ function mergeConfig(options, url) {
var perc_locale = options.perc_locale;

if (langmap.hasOwnProperty(perc_locale)) {
options.language = langmap[perc_locale];
var language = langmap[perc_locale];
options.language = language;
}
}
resolve(options);
Expand All @@ -152,10 +130,6 @@ function mergeConfig(options, url) {
});
}





function getBaseConfig(parameters) {
var options = parameters[0];
var styleFormats = parameters[1];
Expand All @@ -164,28 +138,28 @@ function getBaseConfig(parameters) {
var mergedBaseOptions = $.extend({}, {
"branding": false,
"mode": "textareas",
"selector": "textarea",
"autosave_interval": "10m",
"autosave_retention": "1440m",
"perc_config": "../sys_resources/tinymce/config/default_config.json",
"content_css": "../sys_resources/css/tinymce/content.css",
"theme": "modern",
"theme": "silver",
"editor_selector": "tinymce_callout",
"valid_elements": "*[*]",
"noneditable_leave_contenteditable": true,
"autosave_ask_before_unload": false,
"height": options.height,
"width": "100%",
"external_plugins": {
'percadvimage': '/Rhythmyx/sys_resources/tinymce/plugins/percadvimage/plugin.min.js',
'percadvlink': '/Rhythmyx/sys_resources/tinymce/plugins/percadvlink/plugin.min.js',
'percglobalvariables': '/Rhythmyx/sys_resources/tinymce/plugins/percglobalvariables/plugin.min.js',
'percmorelink': '/Rhythmyx/sys_resources/tinymce/plugins/percmorelink/plugin.min.js'
'percadvimage': '/Rhythmyx/sys_resources/tinymce/plugins/percadvimage/plugin.js',
'percadvlink': '/Rhythmyx/sys_resources/tinymce/plugins/percadvlink/plugin.js',
'percglobalvariables': '/Rhythmyx/sys_resources/tinymce/plugins/percglobalvariables/plugin.js',
'percmorelink': '/Rhythmyx/sys_resources/tinymce/plugins/percmorelink/plugin.js'
},
"style_formats_merge": true,
"style_formats": styleFormats,
"autosave_restore_when_empty": false,
"autosave_restore_when_empty": true,
"init_instance_callback": "percTinyMceInitialized",
"file_browser_callback": $.noop,
"file_picker_callback": $.noop,
"convert_urls" : false,
"toolbar": "newdocument undo redo restoredraft | cut copy paste searchreplace | styleselect fontselect fontsizeselect forecolor backcolor removeformat | bold italic underline strikethrough superscript subscript | alignleft aligncenter alignright alignjustify alignnone | bullist numlist outdent indent | link unlink openlink media | visualchars visualblocks fullscreen print preview | anchor charmap hr emoticons insertdatetime | table tabledelete tableinsertrowafter tabledeleterow tableinsertcolbefore tabledeletecol tablesplitcells tablemergecells | rxinlinelink rxinlinetemplate rxinlineimage rxinserthtml | ltr rtl codesample code"
}, options);
Expand Down Expand Up @@ -249,8 +223,9 @@ function perc_tinymce_init(options) {

getStyles(options)
.then(getBaseConfig)
.then(load_type_config, fail_type_config)
.then(load_user_config, fail_user_config)
.then(load_type_config)
.then(load_user_config, fail_type_config)
.catch(fail_user_config)
.then(init_tinymce);

}

0 comments on commit dbee0a0

Please sign in to comment.