Compare commits

...

1 Commits

Author SHA1 Message Date
Warren Buckley 294452a6aa Note this is a POC branch - init work upgrading from v4 to v5 2019-07-29 15:07:03 +01:00
5 changed files with 301 additions and 106 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -39,7 +39,7 @@
"npm": "^6.4.1", "npm": "^6.4.1",
"signalr": "2.4.0", "signalr": "2.4.0",
"spectrum-colorpicker": "1.8.0", "spectrum-colorpicker": "1.8.0",
"tinymce": "4.9.2", "tinymce": "^5.0.12",
"typeahead.js": "0.11.1", "typeahead.js": "0.11.1",
"underscore": "1.9.1" "underscore": "1.9.1"
}, },
@@ -195,7 +195,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
//distraction-free = Theme: inlite, inline: true //distraction-free = Theme: inlite, inline: true
switch (args.mode) { switch (args.mode) {
case "classic": case "classic":
modeTheme = "modern"; //modeTheme = "modern";
modeTheme = "silver";
modeInline = false; modeInline = false;
break; break;
@@ -206,7 +207,8 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
default: default:
//Will default to 'classic' //Will default to 'classic'
modeTheme = "modern"; //modeTheme = "modern";
modeTheme = "silver";
modeInline = false; modeInline = false;
break; break;
} }
@@ -336,10 +338,10 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
* @param {Object} editor the TinyMCE editor instance * @param {Object} editor the TinyMCE editor instance
*/ */
createInsertEmbeddedMedia: function (editor, callback) { createInsertEmbeddedMedia: function (editor, callback) {
editor.addButton('umbembeddialog', { editor.ui.registry.addButton('umbembeddialog', {
icon: 'custom icon-tv', icon: 'custom icon-tv',
tooltip: 'Embed', tooltip: 'Embed',
onclick: function () { onAction: function (buttonApi) {
if (callback) { if (callback) {
angularHelper.safeApply($rootScope, function() { angularHelper.safeApply($rootScope, function() {
callback(); callback();
@@ -356,10 +358,10 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
createAceCodeEditor: function(editor, callback){ createAceCodeEditor: function(editor, callback){
editor.addButton("ace", { editor.ui.registry.addButton("ace", {
icon: "code", icon: "code",
tooltip: "View Source Code", tooltip: "View Source Code",
onclick: function(){ onAction: function(buttonApi){
if (callback) { if (callback) {
angularHelper.safeApply($rootScope, function() { angularHelper.safeApply($rootScope, function() {
callback(); callback();
@@ -381,11 +383,11 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
* @param {Object} editor the TinyMCE editor instance * @param {Object} editor the TinyMCE editor instance
*/ */
createMediaPicker: function (editor, callback) { createMediaPicker: function (editor, callback) {
editor.addButton('umbmediapicker', { editor.ui.registry.addButton('umbmediapicker', {
icon: 'custom icon-picture', icon: 'custom icon-picture',
tooltip: 'Media Picker', tooltip: 'Media Picker',
stateSelector: 'img', stateSelector: 'img',
onclick: function () { onAction: function (buttonApi) {
var selectedElm = editor.selection.getNode(), var selectedElm = editor.selection.getNode(),
@@ -428,7 +430,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
id: '__mcenew', id: '__mcenew',
'data-udi': img.udi 'data-udi': img.udi
}; };
editor.selection.setContent(editor.dom.createHTML('img', data)); editor.selection.setContent(editor.dom.createHTML('img', data));
$timeout(function () { $timeout(function () {
@@ -447,9 +449,9 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
} }
} }
editor.dom.setAttrib(imgElm, 'id', null); editor.dom.setAttrib(imgElm, 'id', null);
editor.fire('Change'); editor.fire('Change');
}, 500); }, 500);
} }
}, },
@@ -515,13 +517,13 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
} }
/** Adds the button instance */ /** Adds the button instance */
editor.addButton('umbmacro', { editor.ui.registry.addButton('umbmacro', {
icon: 'custom icon-settings-alt', icon: 'custom icon-settings-alt',
tooltip: 'Insert macro', tooltip: 'Insert macro',
onPostRender: function () { onPostRender: function () {
let ctrl = this; let ctrl = this;
/** /**
* Check if the macro is currently selected and toggle the menu button * Check if the macro is currently selected and toggle the menu button
*/ */
@@ -543,7 +545,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
}, },
/** The insert macro button click event handler */ /** The insert macro button click event handler */
onclick: function () { onAction: function (buttonApi) {
var dialogData = { var dialogData = {
//flag for use in rte so we only show macros flagged for the editor //flag for use in rte so we only show macros flagged for the editor
@@ -865,29 +867,29 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
}); });
} }
editor.addButton('link', { editor.ui.registry.addButton('link', {
icon: 'link', icon: 'link',
tooltip: 'Insert/edit link', tooltip: 'Insert/edit link',
shortcut: 'Ctrl+K', shortcut: 'Ctrl+K',
onclick: createLinkList(showDialog), onAction: createLinkList(showDialog),
stateSelector: 'a[href]' stateSelector: 'a[href]'
}); });
editor.addButton('unlink', { // editor.ui.registry.addButton('unlink', {
icon: 'unlink', // icon: 'unlink',
tooltip: 'Remove link', // tooltip: 'Remove link',
cmd: 'unlink', // cmd: 'unlink',
stateSelector: 'a[href]' // stateSelector: 'a[href]'
}); // });
editor.addShortcut('Ctrl+K', '', createLinkList(showDialog)); editor.addShortcut('Ctrl+K', '', createLinkList(showDialog));
this.showDialog = showDialog; this.showDialog = showDialog;
editor.addMenuItem('link', { editor.ui.registry.addMenuItem('link', {
icon: 'link', icon: 'link',
text: 'Insert link', text: 'Insert link',
shortcut: 'Ctrl+K', shortcut: 'Ctrl+K',
onclick: createLinkList(showDialog), onAction: createLinkList(showDialog),
stateSelector: 'a[href]', stateSelector: 'a[href]',
context: 'insert', context: 'insert',
prependToContext: true prependToContext: true
@@ -1134,7 +1136,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
}; };
editorService.linkPicker(linkPicker); editorService.linkPicker(linkPicker);
}); });
}); });
//Create the insert media plugin //Create the insert media plugin
@@ -48,18 +48,19 @@ angular.module("umbraco")
$q.all(promises).then(function (result) { $q.all(promises).then(function (result) {
var standardConfig = result[promises.length - 1]; var standardConfig = result[promises.length - 1];
if (height !== null) { if (height !== null) {
standardConfig.plugins.splice(standardConfig.plugins.indexOf("autoresize"), 1); standardConfig.plugins.splice(standardConfig.plugins.indexOf("autoresize"), 1);
} }
//create a baseline Config to extend upon //create a baseline Config to extend upon
var baseLineConfigObj = { var baseLineConfigObj = {
maxImageSize: editorConfig.maxImageSize, maxImageSize: editorConfig.maxImageSize
width: width, //width: width,
height: height //height: height
}; };
angular.extend(baseLineConfigObj, standardConfig); angular.extend(baseLineConfigObj, standardConfig);
baseLineConfigObj.setup = function (editor) { baseLineConfigObj.setup = function (editor) {
@@ -1,6 +1,6 @@
<div ng-controller="Umbraco.PropertyEditors.RTEController" class="umb-property-editor umb-rte"> <div ng-controller="Umbraco.PropertyEditors.RTEController" class="umb-property-editor umb-rte">
<umb-load-indicator ng-if="isLoading"></umb-load-indicator> <umb-load-indicator ng-if="isLoading"></umb-load-indicator>
<div ng-style="{ visibility : isLoading ? 'hidden' : 'visible', width :containerWidth, height: containerHeight, overflow: containerOverflow}" <div ng-style="{ visibility : isLoading ? 'hidden' : 'visible', overflow: containerOverflow}"
id="{{textAreaHtmlId}}" class="umb-rte-editor"></div> id="{{textAreaHtmlId}}" class="umb-rte-editor"></div>
</div> </div>