From 5d79d5fa73077ce2b2eb0b980ffcd8285c4f3abd Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 17 Apr 2020 16:43:21 +0200 Subject: [PATCH 1/2] fix(md-editor): Migrating to Toast-editor 2.0.1 --- app/app.js | 2 +- app/settings/surveys/attribute-editor.directive.js | 4 ++-- package.json | 2 +- sass/overrides/_tui-markdown.scss | 6 +++++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/app.js b/app/app.js index 70a5093421..36b56f4dc9 100644 --- a/app/app.js +++ b/app/app.js @@ -153,7 +153,7 @@ angular.module('app', return require('sortablejs/Sortable'); }) .factory('Editor', function () { - return require('tui-editor'); + return require('@toast-ui/editor'); }) // inject the router instance into a `run` block by name //.run(['$uiRouter', '$trace', '$location', function ($uiRouter, $trace, $location) { diff --git a/app/settings/surveys/attribute-editor.directive.js b/app/settings/surveys/attribute-editor.directive.js index c778ed2c9a..205dae7b71 100644 --- a/app/settings/surveys/attribute-editor.directive.js +++ b/app/settings/surveys/attribute-editor.directive.js @@ -40,7 +40,7 @@ function ( usageStatistics: false }); - $scope.editor.setValue($scope.editAttribute.instructions); + $scope.editor.setMarkdown($scope.editAttribute.instructions); /** This is a hack to override the tui-editor's own inline-style * that makes the scroll get stuck inside the editor-area */ let editor = document.querySelector('#editSection'); @@ -50,7 +50,7 @@ function ( initiateEditor(); $scope.save = function (editAttribute, activeTask) { - editAttribute.instructions = $scope.editor.getValue(); + editAttribute.instructions = $scope.editor.getMarkdown(); if (!$scope.attributeLabel.$invalid) { $scope.editAttribute.label = $scope.label; $scope.addNewAttribute(editAttribute, activeTask); diff --git a/package.json b/package.json index 692973fcf5..0b3df3768c 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "webpack-hot-middleware": "^2.25.0" }, "dependencies": { + "@toast-ui/editor": "2.0.1", "@uirouter/angularjs": "^1.0.10", "URIjs": "^1.14.1", "angular": "^1.5.6", @@ -127,7 +128,6 @@ "raven-js": "^3.26.3", "socket.io-client": "2.0.3", "sortablejs": "1.10.0", - "tui-editor": "^1.4.7", "underscore": "^1.7.0", "ushahidi-platform-pattern-library": "^4.4.1" }, diff --git a/sass/overrides/_tui-markdown.scss b/sass/overrides/_tui-markdown.scss index 102ff3d91d..d62ffe30e3 100644 --- a/sass/overrides/_tui-markdown.scss +++ b/sass/overrides/_tui-markdown.scss @@ -25,9 +25,13 @@ // Fixes position and appearance of link-popup .tui-popup-wrapper { width: 250px; - left: 20%; + margin-left: -150px; padding: 0px 10px 10px 10px !important; + &.te-heading-add { + margin-left: 10px; + } + .tui-popup-header { padding: 10px 0px; } From 431fa01edbb552655781df5be524e5dcff66703d Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 20 Apr 2020 16:08:24 +0200 Subject: [PATCH 2/2] fix(md-editor): Importing correct css-files --- sass/vendor.scss | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sass/vendor.scss b/sass/vendor.scss index dfa0c348e5..08a5d4a50b 100644 --- a/sass/vendor.scss +++ b/sass/vendor.scss @@ -12,10 +12,8 @@ @import "~leaflet.markercluster/dist/MarkerCluster.Default"; @import "~leaflet.locatecontrol/src/L.Control.Locate"; @import "~nvd3/build/nv.d3"; -@import '~tui-editor/dist/tui-editor.css'; // editor's ui -@import '~tui-editor/dist/tui-editor-contents.css'; // editor's content -@import '~codemirror/lib/codemirror.css'; // codemirror -@import '~highlight.js/styles/github.css'; // code block highlight +@import '~@toast-ui/editor/dist/toastui-editor-viewer.css'; // editor's ui +@import '~@toast-ui/editor/dist/toastui-editor.css'; // editor's content // Custom overrides