From 53f84784bb7e2490786dc664baa7cc42a62c41cd Mon Sep 17 00:00:00 2001 From: pero1203 Date: Mon, 22 Aug 2022 12:14:53 +0200 Subject: [PATCH] =?UTF-8?q?Ckeditor=20-=20dodan=20gumb=20"ve=C4=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/survey/script/js-lang.php | 1 + admin/survey/script/script.js | 64 ++++++++++++------- admin/survey/script/vprasanjeInline.js | 8 +++ editors/ckeditor_4_4/config.js | 1 + public/css/admin_new.css | 32 ++++++++++ .../components/ckeditor/ckeditor.scss | 50 ++++++++++++++- 6 files changed, 132 insertions(+), 24 deletions(-) diff --git a/admin/survey/script/js-lang.php b/admin/survey/script/js-lang.php index 82b4b8833..39521d84c 100644 --- a/admin/survey/script/js-lang.php +++ b/admin/survey/script/js-lang.php @@ -205,6 +205,7 @@ lang('for'); lang('alternative_email_delete'); lang('srv_anketa_deleted_restore_confirm'); lang('srv_data_deleted_restore_confirm'); +lang('more2'); //LOKACIJA diff --git a/admin/survey/script/script.js b/admin/survey/script/script.js index bf5f99a2e..492d849fa 100644 --- a/admin/survey/script/script.js +++ b/admin/survey/script/script.js @@ -1504,7 +1504,20 @@ function normalmode_spremenljivka (spremenljivka) { // prikaze editor za ne-spremenljivko (za karkoli druzga pac) function create_editor (id, focus) { - CKEDITOR.replace(id); + editor = CKEDITOR.replace(id); + + // Dodamo gumb vec + editor.addCommand("advanced_editor_show", { + exec: function(edt) { + advanced_editor_show(); + } + }); + + editor.ui.addButton('More', { + label: lang['more2'], + command: 'advanced_editor_show', + name: "More", + }); //namestitev editorja za tekst pri obveščanju if(gup('a') == 'alert' && focus == false){ @@ -1644,35 +1657,40 @@ function remove_editor (id) { // prikaze editor za spremenljivko (definiran mora biti textarea za idjem naslov_$spremenljivka function editor_display (spremenljivka) { - //if (editor_init != true) { - CKEDITOR.replace( 'naslov_'+spremenljivka ); + editor = CKEDITOR.replace( 'naslov_'+spremenljivka ); - //v kolikor je default vrednost potem naredimo selectAll - var def = $('#naslov_'+spremenljivka).attr("default"); - if( def == 1) { - CKEDITOR.instances['naslov_' + spremenljivka].on('focus', function () { - this.execCommand('selectAll'); - }); - } - // editor_init = true; - //} + // Dodamo gumb vec + editor.addCommand("advanced_editor_show", { + exec: function(edt) { + advanced_editor_show(); + } + }); + editor.ui.addButton('More', { + label: lang['more2'], + command: 'advanced_editor_show', + name: "More", + }); + + //v kolikor je default vrednost potem naredimo selectAll + var def = $('#naslov_'+spremenljivka).attr("default"); + if( def == 1) { + CKEDITOR.instances['naslov_' + spremenljivka].on('focus', function () { + this.execCommand('selectAll'); + }); + } } function editor_display_hotspot (vre_id) { - //if (editor_init != true) { - CKEDITOR.replace( 'hotspot_image_'+vre_id, {toolbar: 'HotSpot', width: 300, removePlugins: 'elementspath'}); //izberi config toolbar HotSpot, sirina naj bo 300px, odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.) + CKEDITOR.replace( 'hotspot_image_'+vre_id, {toolbar: 'HotSpot', width: 300, removePlugins: 'elementspath'}); //izberi config toolbar HotSpot, sirina naj bo 300px, odstrani spodnji tag, kjer po default-u so oznake html (body, p, ipd.) - //v kolikor je default vrednost potem naredimo selectAll - var def = $('#hotspot_image_'+vre_id).attr("default"); - //if( def == 1) { - CKEDITOR.instances['hotspot_image_' + vre_id].on('focus', function () { - this.execCommand('selectAll'); - }); - //} - // editor_init = true; - //} + //v kolikor je default vrednost potem naredimo selectAll + var def = $('#hotspot_image_'+vre_id).attr("default"); + + CKEDITOR.instances['hotspot_image_' + vre_id].on('focus', function () { + this.execCommand('selectAll'); + }); } // odstrani editor (treba preden se odstrani html) diff --git a/admin/survey/script/vprasanjeInline.js b/admin/survey/script/vprasanjeInline.js index e003274ec..2156e6700 100644 --- a/admin/survey/script/vprasanjeInline.js +++ b/admin/survey/script/vprasanjeInline.js @@ -954,6 +954,14 @@ function inline_load_editor (_this) { } } +// Prikazemo / skrijemo napredne gumbe za editor +function advanced_editor_show(){ + /*$('#cke_43, #cke_47, #cke_51').show(); + $('#cke_41').hide();*/ + $('.cke_toolbar:nth-child(10)').hide(); + $('.cke_toolbar:nth-child(12), .cke_toolbar:nth-child(13), .cke_toolbar:nth-child(14)').show(); +} + function inline_load_editor_hotspot (_this, vre_id) { $(_this).css('display', 'none'); diff --git a/editors/ckeditor_4_4/config.js b/editors/ckeditor_4_4/config.js index e52959251..d692004d4 100644 --- a/editors/ckeditor_4_4/config.js +++ b/editors/ckeditor_4_4/config.js @@ -33,6 +33,7 @@ CKEDITOR.editorConfig = function (config) { {name: 'align', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']}, {name: 'list', items: ['NumberedList', 'BulletedList']}, {name: 'links', items: ['Link', 'Unlink', 'Image']}, + {name: 'more', items: ['More']}, '/', {name: 'other', items: ['Scayt', 'Strike', 'SpecialChar']}, {name: 'vec', items:['Styles', 'Format', 'Outdent', 'Indent', 'HorizontalRule']}, diff --git a/public/css/admin_new.css b/public/css/admin_new.css index 579ada81f..2a8f25b4c 100644 --- a/public/css/admin_new.css +++ b/public/css/admin_new.css @@ -10482,6 +10482,38 @@ div.button_holder.editor_button_holder { border-bottom: 0 !important; } +.cke_toolbox span:nth-child(10) .cke_button_icon { + display: none; +} +.cke_toolbox span:nth-child(10) .cke_button_label { + display: inline; + padding-left: 0; +} + +.cke_toolbox span:nth-child(12), +.cke_toolbox span:nth-child(13), +.cke_toolbox span:nth-child(14) { + display: none; +} + +/* +#cke_43, +#cke_47, +#cke_51{ + display: none; +} + +// Gumb vec +#cke_42{ + + .cke_button_icon{ + display: none; + } + .cke_button_label{ + display: inline; + padding-left: 0; + } +}*/ /* Specific pages scss */ diff --git a/resources/sass/admin_new/components/ckeditor/ckeditor.scss b/resources/sass/admin_new/components/ckeditor/ckeditor.scss index 4fb4530c9..f1731f781 100644 --- a/resources/sass/admin_new/components/ckeditor/ckeditor.scss +++ b/resources/sass/admin_new/components/ckeditor/ckeditor.scss @@ -26,4 +26,52 @@ div.button_holder.editor_button_holder{ .cke_dialog table tr td, .cke_dialog table tr th{ border-bottom: 0 !important; -} \ No newline at end of file +} + + +.cke_toolbox span:nth-child(1), +.cke_toolbox span:nth-child(2), +.cke_toolbox span:nth-child(3), +.cke_toolbox span:nth-child(4), +.cke_toolbox span:nth-child(5), +.cke_toolbox span:nth-child(6), +.cke_toolbox span:nth-child(7), +.cke_toolbox span:nth-child(8), +.cke_toolbox span:nth-child(9){ + +} +.cke_toolbox span:nth-child(10){ + .cke_button_icon{ + display: none; + } + .cke_button_label{ + display: inline; + padding-left: 0; + } +} +//.cke_toolbox span:nth-child(11), +.cke_toolbox span:nth-child(12), +.cke_toolbox span:nth-child(13), +.cke_toolbox span:nth-child(14){ + display: none; +} + +/* +#cke_43, +#cke_47, +#cke_51{ + display: none; +} + +// Gumb vec +#cke_42{ + + .cke_button_icon{ + display: none; + } + .cke_button_label{ + display: inline; + padding-left: 0; + } +}*/ +