Ticket #1011: 1011.patch
File 1011.patch, 5.0 KB (added by , 15 years ago) |
---|
-
fckeditor_config.js
12 12 ['Cut','Copy','Paste',/*'PasteText','PasteWord',*/'-','Print'], 13 13 ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], 14 14 ['SpecialChar','Table','Image','Rule'], 15 ['MW_Template','MW_Special','MW_Ref','MW_References','MW_Math' ],15 ['MW_Template','MW_Special','MW_Ref','MW_References','MW_Math','MW_Signature'], 16 16 '/', 17 17 ['FontFormat'], 18 18 ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], … … 36 36 // FCKConfig.DisableObjectResizing = true ; 37 37 38 38 FCKConfig.EditorAreaStyles = '\ 39 .FCK__MWTemplate, .FCK__MWRef, .FCK__MWS pecial, .FCK__MWReferences, .FCK__MWMath, .FCK__MWNowiki, .FCK__MWIncludeonly, .FCK__MWNoinclude, .FCK__MWOnlyinclude, .FCK__MWGallery \39 .FCK__MWTemplate, .FCK__MWRef, .FCK__MWSignature, .FCK__MWSpecial, .FCK__MWReferences, .FCK__MWMath, .FCK__MWNowiki, .FCK__MWIncludeonly, .FCK__MWNoinclude, .FCK__MWOnlyinclude, .FCK__MWGallery \ 40 40 { \ 41 41 border: 1px dotted #00F; \ 42 42 background-position: center center; \ … … 103 103 width: 66px; \ 104 104 height: 15px; \ 105 105 } \ 106 .FCK__MWSignature \ 107 { \ 108 background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_signature.gif); \ 109 width: 66px; \ 110 height: 15px; \ 111 } \ 106 112 .FCK__MWReferences \ 107 113 { \ 108 114 background-image: url(' + FCKConfig.PluginsPath + 'mediawiki/images/icon_references.gif); \ -
plugins/mediawiki/fckplugin.js
74 74 } 75 75 FCKToolbarItems.RegisterItem( 'MW_References', tbButton ) ; 76 76 77 //Signature button 78 var FCKSignature = function( ) { } ; 79 FCKSignature.prototype.GetState = function() { return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED) } ; 80 FCKCommands.RegisterCommand( 'MW_Signature', new FCKSignature() ) ; 81 tbButton = new FCKToolbarButton( 'MW_Signature', 'Signature', FCKLang.wikiBtnSignature || 'Insert signature', FCK_TOOLBARITEM_ONLYICON,true, true, 1 ); 82 tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_signature.gif' ; 83 84 FCKSignature.prototype.Execute = function() 85 { 86 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) 87 return ; 88 89 FCKUndo.SaveUndoStep() ; 90 var e = FCK.EditorDocument.createElement( 'span' ) ; 91 e.className = "fck_mw_signature"; 92 93 oFakeImage = FCK.InsertElement( FCKDocumentProcessor_CreateFakeImage( 'FCK__MWSignature', e ) ) ; 94 } 95 FCKToolbarItems.RegisterItem( 'MW_Signature', tbButton ) ; 96 77 97 tbButton = new FCKToolbarButton( 'MW_Math', 'Formula', FCKLang.wikiBtnFormula || 'Insert/Edit Formula' ) ; 78 98 tbButton.IconPath = FCKConfig.PluginsPath + 'mediawiki/images/tb_icon_math.gif' ; 79 99 FCKToolbarItems.RegisterItem( 'MW_Math', tbButton ) ; … … 579 599 stringBuilder.push( '<references />' ) ; 580 600 return ; 581 601 602 case 'fck_mw_signature' : 603 stringBuilder.push( '--~~~~' ) ; 604 return ; 605 582 606 case 'fck_mw_template' : 583 607 stringBuilder.push( FCKTools.HTMLDecode(htmlNode.innerHTML).replace(/fckLR/g,'\r\n') ) ; 584 608 return ; … … 689 713 690 714 var parentIsSpecialTag = htmlNode.parentNode.getAttribute( '_fck_mw_customtag' ) ; 691 715 var textValue = htmlNode.nodeValue; 692 716 693 717 if ( !parentIsSpecialTag ) 694 718 { 695 719 if ( FCKBrowserInfo.IsIE && this._inLSpace ) { … … 887 911 // MediaWiki document processor. 888 912 FCKDocumentProcessor.AppendNew().ProcessDocument = function( document ) 889 913 { 914 //Change Signatures to SPANS. 915 var aTextNodes = document.getElementsByTagName( '*' ) ; 916 var i = 0 ; 917 while (element = aTextNodes[i++]) { 918 var nodes = element.childNodes ; 919 var j = 0 ; 920 while ( node = nodes[j++] ) 921 { 922 if (node.nodeType == 3) { //textNode 923 var index = 0 ; 924 while (aSignatures = node.nodeValue.match( /--~~~~/g )) //#1011: change Signatures to SPANs. 925 { 926 index = node.nodeValue.indexOf(aSignatures[0]) ; 927 if (index != -1) 928 { 929 var e = FCK.EditorDocument.createElement( 'span' ) ; 930 e.className = "fck_mw_signature"; 931 var oFakeImage = FCKDocumentProcessor_CreateFakeImage( 'FCK__MWSignature', e ) ; 932 933 var substr1 = FCK.EditorDocument.createTextNode( node.nodeValue.substring(0, index) ) ; 934 var substr2 = FCK.EditorDocument.createTextNode( node.nodeValue.substring(index + aSignatures[0].length) ) ; 935 936 node.parentNode.insertBefore( substr1, node ) ; 937 node.parentNode.insertBefore( oFakeImage, node ) ; 938 node.parentNode.insertBefore( substr2, node ) ; 939 940 node.parentNode.removeChild( node ) ; 941 if ( node ) node.nodeValue = '' ; 942 } 943 } 944 } 945 } 946 } 947 948 890 949 // Templates and magic words. 891 950 var aSpans = document.getElementsByTagName( 'SPAN' ) ; 892 951