From 4c703fb38e7fb91b2438dcd2530027d8b15bf327 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 16 Jan 2018 00:29:48 +0100 Subject: [PATCH] Improved past in from word/excel. --- .../javascripts/app/lib/app_post/utils.coffee | 51 ++++++------------- .../javascripts/app/lib/base/word_filter.js | 5 +- 2 files changed, 18 insertions(+), 38 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/utils.coffee b/app/assets/javascripts/app/lib/app_post/utils.coffee index e626d0ab3..74142bd5f 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.coffee @@ -16,15 +16,9 @@ class App.Utils 'text-align', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-collapse', 'border-style', 'border-spacing', - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width', - - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color', + 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', + 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', + 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', ] 'TH': [ 'background', 'background-color', 'color', 'font-size', 'vertical-align', @@ -33,15 +27,10 @@ class App.Utils 'text-align', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-collapse', 'border-style', 'border-spacing', - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width', + 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', + 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', + 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color', ] 'TR': [ 'background', 'background-color', 'color', 'font-size', 'vertical-align', @@ -50,15 +39,10 @@ class App.Utils 'text-align', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-collapse', 'border-style', 'border-spacing', - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width', + 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', + 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', + 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color', ] 'TD': [ 'background', 'background-color', 'color', 'font-size', 'vertical-align', @@ -67,15 +51,10 @@ class App.Utils 'text-align', 'border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-collapse', 'border-style', 'border-spacing', - 'border-top-width', - 'border-right-width', - 'border-bottom-width', - 'border-left-width', + 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', + 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', + 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', - 'border-top-color', - 'border-right-color', - 'border-bottom-color', - 'border-left-color', ] 'IMG': [ 'width', 'height', @@ -235,7 +214,7 @@ class App.Utils # remove comments @_removeComments(html) - # remove work markup + # remove word markup @_removeWordMarkup(html) # remove tags, keep content @@ -256,7 +235,7 @@ class App.Utils # remove comments @_removeComments(html) - # remove work markup + # remove word markup @_removeWordMarkup(html) # remove tags, keep content @@ -280,7 +259,7 @@ class App.Utils # remove comments @_removeComments(html) - # remove work markup + # remove word markup @_removeWordMarkup(html) # remove tags, keep content diff --git a/app/assets/javascripts/app/lib/base/word_filter.js b/app/assets/javascripts/app/lib/base/word_filter.js index 9300d07f9..cd73b5b2e 100644 --- a/app/assets/javascripts/app/lib/base/word_filter.js +++ b/app/assets/javascripts/app/lib/base/word_filter.js @@ -74,8 +74,9 @@ window.word_filter = function(editor){ } }) - $('[style]', editor).removeAttr('style'); - $('[align]', editor).removeAttr('align'); + // style and align is handled by utils.coffee it self, don't clean it here + //$('[style]', editor).removeAttr('style'); + //$('[align]', editor).removeAttr('align'); $('span', editor).replaceWith(function() {return $(this).contents();}); $('span:empty', editor).remove(); $("[class^='Mso']", editor).removeAttr('class');