diff --git a/action/save.php b/action/save.php index d600e442..d7b1d33a 100644 --- a/action/save.php +++ b/action/save.php @@ -10,7 +10,7 @@ */ class action_plugin_ckgedit_save extends DokuWiki_Action_Plugin { - + var $helper = false; function register(Doku_Event_Handler $controller) { $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'ckgedit_save_preprocess'); @@ -18,6 +18,7 @@ function register(Doku_Event_Handler $controller) { function ckgedit_save_preprocess(Doku_Event $event){ global $ACT,$INPUT; + $this->helper = $this->loadhelper('ckgedit'); if (!isset($_REQUEST['ckgedit']) || ! is_array($ACT) || !(isset($ACT['save']) || isset($ACT['preview']))) return; if (isset($_REQUEST["fontdel"]) ) { msg($this->getLang("fontdel"),1); @@ -186,6 +187,9 @@ function ckgedit_save_preprocess(Doku_Event $event){ $TEXT = preg_replace_callback( '#\[\[(.*?)\]\]#ms', function($matches){ + if($this->helper->has_plugin('button') && strpos($matches[0], '[[{') === 0) { + return $matches[0]; + } if(preg_match('/(doku|this)\s*>/',$matches[0])) return $matches[0]; // exclude dokuwiki's wiki links global $ID, $conf; $qs = ""; diff --git a/helper.php b/helper.php index 06e14145..6afe55eb 100644 --- a/helper.php +++ b/helper.php @@ -487,9 +487,9 @@ function FCKeditor_OnComplete( editorInstance ) var len = e.data.dataValue.length; var len = e.data.dataValue.length - 'data:image/png;base64,'.length; var size = formatBytes(len,1); - - var broken_msg = "$ckg_brokenimg " + size - if(e.data.dataValue.match(/data:image\/\w+;base64/) && len > 1000000) { + var broken_msg = ckg_RawImgMsg(); + broken_msg += " " + size; + if(e.data.dataValue.match(/data:image\/\w+;base64/) && len > 2500000) { alert(broken_msg); e.data.dataValue = ''; } diff --git a/lang/en/lang.php b/lang/en/lang.php index 4bb7848f..d283af31 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -62,5 +62,8 @@ $lang['off'] ='off'; $lang['js']['on'] ='on'; $lang['js']['off'] ='off'; -$lang['broken_image'] = 'Use the imagePaste plugin with the Dokuwiki Mediamanager. Raw data of Ctrl-v images cannot exceed 1M. This image is: '; +$lang['broken_image'] = "Use the imagePaste plugin with the Dokuwiki Mediamanager or try the MS Word Paste Tool. Raw data of Ctrl-v images over 2.5M can hang. This image is: " ; +$lang['js']['broken_image_1'] = "Use the imagePaste plugin with the Dokuwiki Mediamanager or try the MS Word Paste Tool."; +$lang['js']['broken_image_2'] = "Ctrl-v images with raw data over 2.5M can hang. This image is: " ; + diff --git a/plugin.info.txt b/plugin.info.txt index 6205a134..de6e7fd7 100755 --- a/plugin.info.txt +++ b/plugin.info.txt @@ -1,7 +1,7 @@ base ckgedit author Myron Turner email turnermm02@shaw.ca -date 2018-11-24 +date 2018-11-28 name ckgedit desc WYSIWYG plugin for Dokuwiki url https://www.dokuwiki.org/plugin:ckgedit diff --git a/script.js b/script.js index 69af8b62..dee2487a 100644 --- a/script.js +++ b/script.js @@ -48,7 +48,7 @@ var HTMLParser_Elements = new Array(); skip = true; match = match.replace(/msword/,""); } - if(p2.length > 1000000 && !skip ) { + if(p2.length > 2500000 && !skip ) { jQuery('#dw__editform').append(''); return '{{' + broken_image + '}}'; } @@ -268,6 +268,7 @@ function dwedit_draft_delete() { document.cookie = 'ckgEdht=' + h +';expires="";path=' +JSINFO['doku_base']; } + /* enable disable image paste */ function ckgd_setImgPaste(which) { var state = JSINFO['ckgEdPaste'] ? JSINFO['ckgEdPaste'] : ""; if(state == 'on') { @@ -279,6 +280,9 @@ function dwedit_draft_delete() { alert(LANG.plugins.ckgedit.ckg_paste_restart + ' ' + LANG.plugins.ckgedit[which]); } + function ckg_RawImgMsg() { + return LANG.plugins.ckgedit.broken_image_1 + "\n" + LANG.plugins.ckgedit.broken_image_2 ; + } function GetE(e) { return document.getElementById(e); } diff --git a/scripts/parse_wiki.js.unc b/scripts/parse_wiki.js.unc index b6bb9764..fadbb7d7 100644 --- a/scripts/parse_wiki.js.unc +++ b/scripts/parse_wiki.js.unc @@ -1894,13 +1894,14 @@ results = results.replace(/(\s*={2,})(.*?)(\[\[|\{\{)(.*?)(\]\]|\}\})(.*?)\1/gm, if(!useComplexTables) { results = results.replace(/~~COMPLEX_TABLES~~/gm,""); } results=results.replace(/_CKG_ASTERISK_/gm,'*'); results = results.replace(/_ESC_BKSLASH_/g,'\\'); + results=results.replace(/divalNLine/gm,"\n"); if(id == 'test') { if(HTMLParser_test_result(results)) { alert(results); } return; } - results=results.replace(/divalNLine/gm,"\n") + var dwform = GetE('dw__editform'); dwform.elements.fck_wikitext.value = results; diff --git a/version b/version index 4610f6af..f8f36dc7 100644 --- a/version +++ b/version @@ -1,2 +1,2 @@ -master_18-Nov_24-05_23 +master_18-Nov_28-19_27