From 640d2cedb9c79a99517d9fd503e1361e6844b18f Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 1 Jul 2019 21:48:45 +1000 Subject: [PATCH] Gets the link and media pickers working in the grid in the rte with ignore start nodes --- .../directives/components/grid/grid.rte.directive.js | 12 +++++++++++- .../src/common/services/tinymce.service.js | 1 + .../src/views/propertyeditors/grid/editors/rte.html | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index dee3cfdab7..8e561ff5ca 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -4,7 +4,9 @@ angular.module("umbraco.directives") scope: { uniqueId: '=', value: '=', - configuration: "=" + configuration: "=", //this is the RTE configuration + datatypeId: '@', + ignoreUserStartNodes: '@' }, templateUrl: 'views/components/grid/grid-rte.html', replace: true, @@ -35,6 +37,14 @@ angular.module("umbraco.directives") editorConfig.maxImageSize = tinyMceService.defaultPrevalues().maxImageSize; } + //ensure the grid's global config is being passed up to the RTE, these 2 properties need to be in this format + //since below we are just passing up `scope` as the actual model and for 2 way binding to work with `value` that + //is the way it needs to be unless we start adding watchers. We'll just go with this for now but it's super ugly. + scope.config = { + ignoreUserStartNodes: scope.ignoreUserStartNodes === "true" + } + scope.dataTypeId = scope.datatypeId; //Yes - this casing is rediculous, but it's because the var starts with `data` so it can't be `data-type-id` :/ + //stores a reference to the editor var tinyMceEditor = null; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 3355b15570..19e3d3d970 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -1155,6 +1155,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s var linkPicker = { currentTarget: currentTarget, dataTypeId: args.model.dataTypeId, + ignoreUserStartNodes: args.model.config.ignoreUserStartNodes, anchors: getCurrentAnchorNames(), submit: function (model) { self.insertLinkInEditor(args.editor, model.target, anchorElement); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.html index 7741bcadff..63bc7570e1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/editors/rte.html @@ -3,7 +3,9 @@ + unique-id="control.$uniqueId" + datatype-id="{{model.dataTypeId}}" + ignore-user-start-nodes="{{model.config.ignoreUserStartNodes}}">