[FIX] website editor: Some elements display font-size more than range, add default size

This commit is contained in:
Christophe Matthieu
2015-01-08 11:01:42 +01:00
parent f81698c86c
commit d26e5ac091
+3 -3
View File
@@ -771,7 +771,7 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor)
}
if (from.parentNode === to) {
while (from.lastChild) {
insertAfter(from.lastChild, from);
dom.insertAfter(from.lastChild, from);
}
} else {
while (from.firstChild && from.firstChild != to) {
@@ -1747,7 +1747,7 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor)
return false;
};
options.fontSizes = ['8', '9', '10', '11', '12', '14', '18', '24', '36'];
options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 14, 18, 24, 36, 48, 62];
$.summernote.pluginEvents.applyFont = function (event, editor, layoutInfo, color, bgcolor, size) {
var rng = range.create();
var startPoint = rng.getStartPoint();
@@ -1846,7 +1846,7 @@ define(['summernote/editing/Editor', 'summernote/summernote'], function (Editor)
}
if (size) {
font.style.fontSize = "inherit";
if (parseInt(window.getComputedStyle(font).fontSize, 10) != size) {
if (!isNaN(size) && Math.abs(parseInt(window.getComputedStyle(font).fontSize, 10)-size)/size > 0.05) {
font.style.fontSize = size + "px";
}
}