From b8c85e44968df6ade1a041ec7af0b98fcc5feeaa Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 23 Jun 2013 14:07:59 +0100 Subject: [PATCH 1/3] Bugfix whereby multiple 'format' buttons appeared (each subsequent text area had n+1 number of format buttons). Fix in latest Chrome --- assets/symphony.ckeditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/symphony.ckeditor.js b/assets/symphony.ckeditor.js index cf022f2..b6ba377 100755 --- a/assets/symphony.ckeditor.js +++ b/assets/symphony.ckeditor.js @@ -38,7 +38,8 @@ jQuery(document).ready(function () { { if(ckeditor_presets[i].class == myClassName) { - var info = ckeditor_presets[i]; + //var info = ckeditor_presets[i]; + var info = jQuery.extend(true, {}, ckeditor_presets[i]); info.toolbar.unshift(formatBlock); ck_configurationData.toolbar = info.toolbar; ck_configurationData.resize_enabled = info.resize; From 938cea10c4945e47c2a5637ee98674847acd24cb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 17 Nov 2013 23:07:18 +0000 Subject: [PATCH 2/3] CKEditor Query Bugfix --- extension.driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.driver.php b/extension.driver.php index 540302a..00cabe4 100755 --- a/extension.driver.php +++ b/extension.driver.php @@ -150,7 +150,7 @@ public function appendPresets($context) $ol->appendChild($template); // Append all the fields: - $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets'); + $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`'); $index = 0; foreach($presets as $preset) { From b741cae468cb236c930da5ba73827de1b7a0775d Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 27 May 2014 20:25:27 +0100 Subject: [PATCH 3/3] Bugfix for symphony 2.4 compatibility + Preferences Page duplicator code - added container div and classes to make compatible + installation - only insert default presets if none exist (prevent multiple presets if the install fails) Signed-off-by: David Anderson --- extension.driver.php | 60 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/extension.driver.php b/extension.driver.php index 00cabe4..c25bef1 100755 --- a/extension.driver.php +++ b/extension.driver.php @@ -111,10 +111,21 @@ public function appendPresets($context) } $this->sections[] = $a; } - + + + /* + + LINK TEMPLATES + + */ + $fieldset->appendChild(new XMLElement('p', __('Link templates:'), array('class' => 'label'))); + + $linkOuter = new XMLElement('div', null, array( + 'class' => 'frame ckeditor-duplicator' + )); + $ol = new XMLElement('ol'); - $ol->setAttribute('class', 'ckeditor-duplicator'); $templates = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_link_templates`;'); if(!is_array($pages)) $pages = array($pages); @@ -130,13 +141,23 @@ public function appendPresets($context) $duplicator = $this->__buildDuplicatorItem($page, NULL); $ol->appendChild($duplicator); } - - $fieldset->appendChild($ol); - - // Plugin presets: + + $linkOuter->appendChild($ol); + $fieldset->appendChild($linkOuter); + + /* + + PLUGIN PRESENTS + + */ $fieldset->appendChild(new XMLElement('p', __('Plugin presets:'), array('class' => 'label'))); + + $out_wrapper = new XMLElement('div', null, array( + 'class' => 'frame ckeditor-duplicator', + 'id' => 'ckeditor-duplicator' + )); + $ol = new XMLElement('ol'); - $ol->setAttribute('class', 'ckeditor-duplicator'); // Create template: $template = new XMLElement('li', null, array('class' => 'template')); @@ -152,9 +173,13 @@ public function appendPresets($context) // Append all the fields: $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`'); $index = 0; + foreach($presets as $preset) { $template = new XMLElement('li'); + + $template->setAttribute('class','instance expanded'); + $template->appendChild(new XMLElement('header', '

'.$preset['name'].'

')); $template->appendChild(Widget::Label(__('Name'), Widget::Input('ckeditor_presets['.$index.'][name]', $preset['name']))); $template->appendChild(Widget::Label(__('Toolbar'), @@ -172,8 +197,10 @@ public function appendPresets($context) $ol->appendChild($template); $index++; } - - $fieldset->appendChild($ol); + + + $out_wrapper->appendChild($ol); + $fieldset->appendChild($out_wrapper); // Styles: $fieldset->appendChild(new XMLElement('p', __('Styles: (one style per line: h3.example { color: #f00; background: #0f0; }) Class name is converted to name (h3.hello-world = Hello World).'), array('class'=>'label'))); @@ -345,20 +372,29 @@ public function install() ) ENGINE = MYISAM ; "); - // Fill default presets: - Symphony::Database()->query(" + /* + Fill default presets + + Only if table is empty (prevents loads being created if installs fail + + */ + $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`'); + if(count($presets) < 1){ + + Symphony::Database()->query(" INSERT INTO `tbl_ckeditor_presets` (`name`, `toolbar`, `plugins`, `resize`, `outline`) VALUES ('Minimal', '[''Bold'', ''Italic'', ''Strike'', ''-'', ''Subscript'', ''Superscript''],\r\n[''Link'', ''Unlink''],\r\n[''Source'']', NULL, NULL, NULL), ('Normal', '[''Bold'', ''Italic'', ''Strike'', ''-'', ''Subscript'', ''Superscript''],\r\n[''NumberedList'', ''BulletedList'', ''-'', ''Outdent'', ''Indent'', ''Blockquote''],\r\n[''Image'', ''oembed''],[''Link'', ''Unlink''],\r\n[''HorizontalRule''],\r\n[''Source'', ''Maximize'']', NULL, 1, 1), ('Full', '{ name: ''document'', items : [ ''Source'',''-'',''Save'',''NewPage'',''DocProps'',''Preview'',''Print'',''-'',''Templates'' ] },\r\n { name: ''clipboard'', items : [ ''Cut'',''Copy'',''Paste'',''PasteText'',''PasteFromWord'',''-'',''Undo'',''Redo'' ] },\r\n { name: ''editing'', items : [ ''Find'',''Replace'',''-'',''SelectAll'',''-'',''SpellChecker'', ''Scayt'' ] },\r\n { name: ''forms'', items : [ ''Form'', ''Checkbox'', ''Radio'', ''TextField'', ''Textarea'', ''Select'', ''Button'', ''ImageButton'', ''HiddenField'' ] },\r\n ''/'',\r\n { name: ''basicstyles'', items : [ ''Bold'',''Italic'',''Underline'',''Strike'',''Subscript'',''Superscript'',''-'',''RemoveFormat'' ] },\r\n { name: ''paragraph'', items : [ ''NumberedList'',''BulletedList'',''-'',''Outdent'',''Indent'',''-'',''Blockquote'',''CreateDiv'',''-'',''JustifyLeft'',''JustifyCenter'',''JustifyRight'',''JustifyBlock'',''-'',''BidiLtr'',''BidiRtl'' ] },\r\n { name: ''links'', items : [ ''Link'',''Unlink'',''Anchor'' ] },\r\n { name: ''insert'', items : [ ''Image'',''Flash'',''Table'',''HorizontalRule'',''Smiley'',''SpecialChar'',''PageBreak'' ] },\r\n ''/'',\r\n { name: ''styles'', items : [ ''Styles'',''Format'',''Font'',''FontSize'' ] },\r\n { name: ''colors'', items : [ ''TextColor'',''BGColor'' ] },\r\n { name: ''tools'', items : [ ''Maximize'', ''ShowBlocks'',''-'',''About'' ] }', NULL, 1, 1); "); + + } // Delete formatter files: $formatters = glob(EXTENSIONS.'/ckeditor/text-formatters/formatter.*.php'); foreach($formatters as $formatter) { unlink($formatter); } // Create it all new: - $presets = Symphony::Database()->fetch('SELECT * FROM `tbl_ckeditor_presets`;'); foreach($presets as $preset) { unset($preset['id']);