Browse Source

修正版式正文从work粘贴后,段落首行缩进的问题

huqi 5 years ago
parent
commit
8aff35e538
1 changed files with 16 additions and 0 deletions
  1. 16 0
      o2web/source/x_component_process_Xform/Documenteditor.js

+ 16 - 0
o2web/source/x_component_process_Xform/Documenteditor.js

@@ -1545,6 +1545,9 @@ debugger;
 
 
         //editorConfig.extraAllowedContent = mathElements.join(' ') + '(*)[*]{*};img[data-mathml,data-custom-editor,role](Wirisformula)';
         //editorConfig.extraAllowedContent = mathElements.join(' ') + '(*)[*]{*};img[data-mathml,data-custom-editor,role](Wirisformula)';
 
 
+        editorConfig.pasteFromWordRemoveFontStyles = false;
+        editorConfig.pasteFromWordRemoveStyles = false;
+
         //editorConfig.removeButtons = 'NewPage,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Bold,Italic,Underline,Strike,Subscript,Superscript,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,SpecialChar,Iframe,Styles,Font,FontSize,TextColor,BGColor,ShowBlocks,About';
         //editorConfig.removeButtons = 'NewPage,Templates,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Bold,Italic,Underline,Strike,Subscript,Superscript,Blockquote,CreateDiv,BidiLtr,BidiRtl,Language,Link,Unlink,Anchor,Image,Flash,HorizontalRule,Smiley,SpecialChar,Iframe,Styles,Font,FontSize,TextColor,BGColor,ShowBlocks,About';
         editorConfig.removePlugins = ['magicline'];
         editorConfig.removePlugins = ['magicline'];
         editorConfig.enterMode = 3;
         editorConfig.enterMode = 3;
@@ -1681,6 +1684,19 @@ debugger;
                     window.setTimeout(this.reLocationFiletextToolbar.bind(this), 10);
                     window.setTimeout(this.reLocationFiletextToolbar.bind(this), 10);
                 }.bind(this) );
                 }.bind(this) );
 
 
+                this.filetextEditor.on( 'paste', function( e ) {
+                    var html = e.data.dataValue;
+                    var tmp = new Element("div")
+                    tmp.set("html", html);
+                    var pList = tmp.getElements("p");
+                    pList.each(function(p, i){
+                        var textIndent = p.getStyle("text-indent");
+                        if (textIndent.toInt()) p.appendText("  ","top");
+                    });
+                    e.data.dataValue = tmp.get("html");
+                    tmp.destroy();
+                }.bind(this) );
+
                 // this.filetextEditor.on("key", function(e){
                 // this.filetextEditor.on("key", function(e){
                 //     debugger;
                 //     debugger;
                 // }.bind(this));
                 // }.bind(this));