글꼴 크기 커스터마이징 완료

This commit is contained in:
2018-08-30 02:41:58 +09:00
parent ef6678d8b0
commit c77b79f0d2
2 changed files with 43 additions and 37 deletions
+14 -14
View File
@@ -1,27 +1,27 @@
.trumbowyg-fontsize_24pt-dropdown-button{ .trumbowyg-fontsize_24px-dropdown-button{
min-height:25pt; min-height:25px;
} }
.trumbowyg-fontsize_28pt-dropdown-button{ .trumbowyg-fontsize_28px-dropdown-button{
min-height:29pt; min-height:29px;
} }
.trumbowyg-fontsize_32pt-dropdown-button{ .trumbowyg-fontsize_32px-dropdown-button{
min-height:33pt; min-height:33px;
} }
.trumbowyg-fontsize_40pt-dropdown-button{ .trumbowyg-fontsize_40px-dropdown-button{
min-height:41pt; min-height:41px;
} }
.trumbowyg-fontsize_46pt-dropdown-button{ .trumbowyg-fontsize_46px-dropdown-button{
min-height:47pt; min-height:47px;
} }
.trumbowyg-fontsize_52pt-dropdown-button{ .trumbowyg-fontsize_52px-dropdown-button{
min-height:53pt; min-height:53px;
} }
.trumbowyg-fontsize_60pt-dropdown-button{ .trumbowyg-fontsize_60px-dropdown-button{
min-height:61pt; min-height:61px;
} }
+29 -23
View File
@@ -7,11 +7,6 @@
en: { en: {
fontsize: 'Font size', fontsize: 'Font size',
fontsizes: { fontsizes: {
'x-small': 'Extra small',
'small': 'Small',
'medium': 'Regular',
'large': 'Large',
'x-large': 'Extra large',
'custom': 'Custom' 'custom': 'Custom'
} }
}, },
@@ -41,30 +36,41 @@
function buildDropdown(trumbowyg) { function buildDropdown(trumbowyg) {
var dropdown = []; var dropdown = [];
var sizes = [ var sizes = [
'8pt', '8px',
'9pt', '9px',
'10pt', '10px',
'11pt', '11px',
'12pt', '12px',
'14pt', '14px',
'16pt', '16px',
'18pt', '18px',
'20pt', '20px',
'24pt', '24px',
'28pt', '28px',
'32pt', '32px',
'40pt', '40px',
'46pt', '46px',
'52pt', '52px',
'60pt' '60px'
]; ];
$.each(sizes, function (index, size) { $.each(sizes, function (index, size) {
trumbowyg.addBtnDef('fontsize_' + size, { trumbowyg.addBtnDef('fontsize_' + size, {
text: '<span style="font-size: ' + size + ';line-height: ' + size + '">' + size + '</span>', text: '<span style="font-size: ' + size + ';">' + size + '</span>',
hasIcon: false, hasIcon: false,
fn: function () { fn: function () {
trumbowyg.execCmd('fontSize', index + 1, true); trumbowyg.saveRange();
var text = trumbowyg.range.startContainer.parentElement;
var selectedText = trumbowyg.getRangeText();
if ($(text).html() === selectedText) {
$(text).css('font-size', size);
} else {
trumbowyg.range.deleteContents();
var html = '<span style="font-size: ' + size + ';">' + selectedText + '</span>';
var node = $(html)[0];
trumbowyg.range.insertNode(node);
}
trumbowyg.saveRange();
} }
}); });
dropdown.push('fontsize_' + size); dropdown.push('fontsize_' + size);