/** * Copyright (c) 2014-2016, CKSource - Frederico Knabben. All rights reserved. * Licensed under the terms of the MIT License (see LICENSE.md). * * The abbr plugin dialog window definition. * * Created out of the CKEditor Plugin SDK: * http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1 */ // Our dialog definition. CKEDITOR.dialog.add( 'mswordDialog', function( editor ) { var ed_lang = editor.lang.msword; /*top right bottom left*/ // var olstyle ='list-style: decimal-leading-zero; font-size: 1.1em; margin: 0 0 0 .25em'; var olstyle ='font-size: 1.1em;'; var oli = '
  • '; return { // Basic properties of the dialog window: title, minimum size. title: 'MS Word', minWidth: 600, minHeight: 350, // Dialog window content definition. contents: [ { // Definition of the Basic Settings dialog tab (page). id: 'tab-basic', label: 'Text', // The tab content. elements: [ { type: 'html', html: '
    ', minWidth: 350, minHeight: 350, }, { type: 'hbox', height: [ '18px;'], children: [ { type: 'html', html: editor.lang.msword.info, } ] //hbox children }, //hbox ], //elements }, //contents { id: 'Info', label: editor.lang.msword.instructionsLabel, elements: [ { type: 'html', html: "
    1. "+ ed_lang.instructions +'
    2. ' +'
    3. ' + ed_lang.instructions_2 + '
    4. ' +'
      • '+ed_lang.instructions_3 + '
      • ' +'
      • '+ed_lang.instructions_4 + '
      • ' + '
      • '+ed_lang.instructions_5 + '
      ' +'
    5. ' + ed_lang.instructions_6 + '
    6. ' +'
    ', }, ] } ], //contents onShow : function() { var dialog = this; geshi_dialog = dialog; selection = editor.getSelection(); var selected=editor.getSelectedHtml(true) ; if(selected) { var data_id = document.getElementById('ckgedit_mswin'); data_id.innerHTML = selected; } jQuery( "#ckgedit_mswin" ).keydown(function(ev) { if (ev.which == 13 ) { ev.stopPropagation(); } }); }, onOk: function() { // The context of this function is the dialog object itself. // http://docs.ckeditor.com/#!/api/CKEDITOR.dialog var data_id = document.getElementById('ckgedit_mswin'); var inner = data_id.innerHTML; inner = inner.replace(/</gm,'<'); inner = inner.replace(/>/mg,'>'); //if(confirm("exit now") { //jQuery('.cke_dialog_ui_button_cancel').children().click(); // } var regex = new RegExp('([^]*)<\/xml>','gm'); inner = inner.replace(regex, function(m,n) { return ""; }); if(inner.match(/\"msword\"([^]*)<\/style>','gm'); inner = inner.replace(regex, function(m,n) { return ""; }); regex = new RegExp('\\<\\!--\\[.*?endif\\]--\\>\\<\\!--\\[if gte.*?\\]\\>([^]*)\\<\\!\\[endif\\]-->','mg'); inner = inner.replace(regex,""); // alert("START\n" +inner +"\nSTOP"); inner = inner.replace(/</gm,'<'); inner = inner.replace(/>/mg,'>'); inner = inner.replace(//mg, ""); inner = inner.replace(//mg, "
    "); inner = inner.replace(//mg, ""); inner = inner.replace(//mg, "([^]+)<\/tbody>/,function(m){ m = m.replace(/<\/p>/mg,""); return m.replace(//mg,""); }); inner = inner.replace(/

    ([\s\S]+)

    .*?\n(.*?)\/p>/gm, function(m,w){ var n = m; n = n.replace(/ /gm,""); var ar = n.split(/\n/); var str = ""; var list_type = "ul"; for(j=0;j[a-b0-9]/)) { list_type = 'ol'; } // alert(list_type); ar[j] = ar[j].replace(//,""); ar[j] = ar[j].replace(/<\/p>/,""); ar[j] = ar[j].replace(/(\d*|·)/,""); str += "<" + list_type +">"; } else if (ar[j].match(/SpMiddle/)) { ar[j] = ar[j].replace(//,""); ar[j] = ar[j].replace(//,""); ar[j] = ar[j].replace(/<\/p>/,""); } else if (ar[j].match(/SpLast/)) { ar[j] = ar[j].replace(//,""); ar[j] = ar[j].replace(/<\/p>/,""); ar[j] = ar[j].replace(/^\s+/,""); } else { ar[j] = ar[j].replace(/<\/p>/,""); ar[j] = ar[j].replace(/^\s+/,""); ar[j] = ar[j].replace(/\s+$/,""); str+='

  • '; str+=ar[j] + '
  • '; } } str = str.replace(/
  • ·*<\/li>/gm,""); str+=""; return str; } ); if(inner) { editor.insertHtml(inner); } data_id.innerHTML =""; } }; });
  • "); inner = inner.replace(/style="([^>]+)"/gm,function(m,i){ matches = i.match(/level(\d)/); if(matches) { return 'L_'+matches[1]; } return m; }); inner = inner.replace(/style="[^>]+"/gm,""); inner = inner.replace(//gm,""); inner = inner.replace(/()+/gm,""); inner = inner.replace(/(<\/span>)+/gm,""); inner = inner.replace(/