From ef6678d8b067db43de7409fe49197c8a7ec6aa0e Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 30 Aug 2018 02:12:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=94=94=ED=84=B0=20=EA=B8=80?= =?UTF-8?q?=EA=BC=B4=20=ED=81=AC=EA=B8=B0=20=EC=BB=A4=EC=8A=A4=ED=84=B0?= =?UTF-8?q?=EB=A7=88=EC=9D=B4=EC=A7=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e_lib/trumbowyg/trumbowyg.fontsize.css | 27 +++++++ e_lib/trumbowyg/trumbowyg.fontsize.js | 107 +++++++++++++++++++++++++ hwe/b_dipcenter.php | 3 +- 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 e_lib/trumbowyg/trumbowyg.fontsize.css create mode 100644 e_lib/trumbowyg/trumbowyg.fontsize.js diff --git a/e_lib/trumbowyg/trumbowyg.fontsize.css b/e_lib/trumbowyg/trumbowyg.fontsize.css new file mode 100644 index 00000000..cbd6631c --- /dev/null +++ b/e_lib/trumbowyg/trumbowyg.fontsize.css @@ -0,0 +1,27 @@ +.trumbowyg-fontsize_24pt-dropdown-button{ + min-height:25pt; +} + +.trumbowyg-fontsize_28pt-dropdown-button{ + min-height:29pt; +} + +.trumbowyg-fontsize_32pt-dropdown-button{ + min-height:33pt; +} + +.trumbowyg-fontsize_40pt-dropdown-button{ + min-height:41pt; +} + +.trumbowyg-fontsize_46pt-dropdown-button{ + min-height:47pt; +} + +.trumbowyg-fontsize_52pt-dropdown-button{ + min-height:53pt; +} + +.trumbowyg-fontsize_60pt-dropdown-button{ + min-height:61pt; +} \ No newline at end of file diff --git a/e_lib/trumbowyg/trumbowyg.fontsize.js b/e_lib/trumbowyg/trumbowyg.fontsize.js new file mode 100644 index 00000000..19231cf2 --- /dev/null +++ b/e_lib/trumbowyg/trumbowyg.fontsize.js @@ -0,0 +1,107 @@ +(function ($) { + 'use strict'; + + $.extend(true, $.trumbowyg, { + langs: { + // jshint camelcase:false + en: { + fontsize: 'Font size', + fontsizes: { + 'x-small': 'Extra small', + 'small': 'Small', + 'medium': 'Regular', + 'large': 'Large', + 'x-large': 'Extra large', + 'custom': 'Custom' + } + }, + ko: { + fontsize: '글자 크기', + fontsizes: { + 'custom': '사용자 정의' + } + }, + } + }); + // jshint camelcase:true + + // Add dropdown with font sizes + $.extend(true, $.trumbowyg, { + plugins: { + fontsize: { + init: function (trumbowyg) { + trumbowyg.addBtnDef('fontsize', { + dropdown: buildDropdown(trumbowyg) + }); + } + } + } + }); + + function buildDropdown(trumbowyg) { + var dropdown = []; + var sizes = [ + '8pt', + '9pt', + '10pt', + '11pt', + '12pt', + '14pt', + '16pt', + '18pt', + '20pt', + '24pt', + '28pt', + '32pt', + '40pt', + '46pt', + '52pt', + '60pt' + ]; + + $.each(sizes, function (index, size) { + trumbowyg.addBtnDef('fontsize_' + size, { + text: '' + size + '', + hasIcon: false, + fn: function () { + trumbowyg.execCmd('fontSize', index + 1, true); + } + }); + dropdown.push('fontsize_' + size); + }); + + var freeSizeButtonName = 'fontsize_custom', + freeSizeBtnDef = { + fn: function () { + trumbowyg.openModalInsert('Custom Font Size', + { + size: { + label: 'Font Size', + value: '48px' + } + }, + function (values) { + var text = trumbowyg.range.startContainer.parentElement; + var selectedText = trumbowyg.getRangeText(); + if ($(text).html() === selectedText) { + $(text).css('font-size', values.size); + } else { + trumbowyg.range.deleteContents(); + var html = '' + selectedText + ''; + var node = $(html)[0]; + trumbowyg.range.insertNode(node); + } + trumbowyg.saveRange(); + return true; + } + ); + }, + text: '' + trumbowyg.lang.fontsizes.custom + '', + hasIcon: false + }; + trumbowyg.addBtnDef(freeSizeButtonName, freeSizeBtnDef); + dropdown.push(freeSizeButtonName); + + return dropdown; + } +})(jQuery); diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php index 4963108e..4f095092 100644 --- a/hwe/b_dipcenter.php +++ b/hwe/b_dipcenter.php @@ -56,7 +56,7 @@ var editable = =5?'true':'false')?>; - + @@ -64,6 +64,7 @@ var editable = =5?'true':'false')?>; +