升级summernote到最新版本v0.8.12

master
RuoYi 5 years ago committed by Limy
parent ed520859ac
commit 50c27af465

@ -11,7 +11,7 @@
strikethrough: '删除线',
subscript: '下标',
superscript: '上标',
size: '字号'
size: '字号',
},
image: {
image: '图片',
@ -33,14 +33,14 @@
maximumFileSizeError: '文件大小超出最大值。',
url: '图片地址',
remove: '移除图片',
original: '原始图片'
original: '原始图片',
},
video: {
video: '视频',
videoLink: '视频链接',
insert: '插入视频',
url: '视频地址',
providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)'
providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)',
},
link: {
link: '链接',
@ -49,7 +49,7 @@
edit: '编辑链接',
textToDisplay: '显示文本',
url: '链接地址',
openInNewWindow: '在新窗口打开'
openInNewWindow: '在新窗口打开',
},
table: {
table: '表格',
@ -59,10 +59,10 @@
addColRight: '在右侧插入列',
delRow: '删除行',
delCol: '删除列',
delTable: '删除表格'
delTable: '删除表格',
},
hr: {
insert: '水平线'
insert: '水平线',
},
style: {
style: '样式',
@ -74,16 +74,16 @@
h3: '标题 3',
h4: '标题 4',
h5: '标题 5',
h6: '标题 6'
h6: '标题 6',
},
lists: {
unordered: '无序列表',
ordered: '有序列表'
ordered: '有序列表',
},
options: {
help: '帮助',
fullscreen: '全屏',
codeview: '源代码'
codeview: '源代码',
},
paragraph: {
paragraph: '段落',
@ -92,7 +92,7 @@
left: '左对齐',
center: '居中对齐',
right: '右对齐',
justify: '两端对齐'
justify: '两端对齐',
},
color: {
recent: '最近使用',
@ -102,7 +102,7 @@
transparent: '透明',
setTransparent: '透明',
reset: '重置',
resetToDefault: '默认'
resetToDefault: '默认',
},
shortcut: {
shortcuts: '快捷键',
@ -111,7 +111,7 @@
action: '动作',
paragraphFormatting: '段落格式',
documentStyle: '文档样式',
extraKeys: '额外按键'
extraKeys: '额外按键',
},
help: {
insertParagraph: '插入段落',
@ -140,16 +140,16 @@
formatH5: '设置选中内容样式为 标题5',
formatH6: '设置选中内容样式为 标题6',
insertHorizontalRule: '插入水平线',
'linkDialog.show': '显示链接对话框'
'linkDialog.show': '显示链接对话框',
},
history: {
undo: '撤销',
redo: '重做'
redo: '重做',
},
specialChar: {
specialChar: '特殊字符',
select: '选取特殊字符'
}
}
select: '选取特殊字符',
},
},
});
})(jQuery);

@ -1,3 +0,0 @@
/*! Summernote v0.8.11 | (c) 2013- Alan Hong and other contributors | MIT license */
!function(e){e.extend(e.summernote.lang,{"zh-CN":{font:{bold:"粗体",italic:"斜体",underline:"下划线",clear:"清除格式",height:"行高",name:"字体",strikethrough:"删除线",subscript:"下标",superscript:"上标",size:"字号"},image:{image:"图片",insert:"插入图片",resizeFull:"缩放至 100%",resizeHalf:"缩放至 50%",resizeQuarter:"缩放至 25%",floatLeft:"靠左浮动",floatRight:"靠右浮动",floatNone:"取消浮动",shapeRounded:"形状: 圆角",shapeCircle:"形状: 圆",shapeThumbnail:"形状: 缩略图",shapeNone:"形状: 无",dragImageHere:"将图片拖拽至此处",dropImage:"拖拽图片或文本",selectFromFiles:"从本地上传",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"图片地址",remove:"移除图片",original:"原始图片"},video:{video:"视频",videoLink:"视频链接",insert:"插入视频",url:"视频地址",providers:"(优酷, 腾讯, Instagram, DailyMotion, Youtube等)"},link:{link:"链接",insert:"插入链接",unlink:"去除链接",edit:"编辑链接",textToDisplay:"显示文本",url:"链接地址",openInNewWindow:"在新窗口打开"},table:{table:"表格",addRowAbove:"在上方插入行",addRowBelow:"在下方插入行",addColLeft:"在左侧插入列",addColRight:"在右侧插入列",delRow:"删除行",delCol:"删除列",delTable:"删除表格"},hr:{insert:"水平线"},style:{style:"样式",p:"普通",blockquote:"引用",pre:"代码",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"},lists:{unordered:"无序列表",ordered:"有序列表"},options:{help:"帮助",fullscreen:"全屏",codeview:"源代码"},paragraph:{paragraph:"段落",outdent:"减少缩进",indent:"增加缩进",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐"},color:{recent:"最近使用",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重置",resetToDefault:"默认"},shortcut:{shortcuts:"快捷键",close:"关闭",textFormatting:"文本格式",action:"动作",paragraphFormatting:"段落格式",documentStyle:"文档样式",extraKeys:"额外按键"},help:{insertParagraph:"插入段落",undo:"撤销",redo:"重做",tab:"增加缩进",untab:"减少缩进",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",removeFormat:"清除格式",justifyLeft:"左对齐",justifyCenter:"居中对齐",justifyRight:"右对齐",justifyFull:"两端对齐",insertUnorderedList:"无序列表",insertOrderedList:"有序列表",outdent:"减少缩进",indent:"增加缩进",formatPara:"设置选中内容样式为 普通",formatH1:"设置选中内容样式为 标题1",formatH2:"设置选中内容样式为 标题2",formatH3:"设置选中内容样式为 标题3",formatH4:"设置选中内容样式为 标题4",formatH5:"设置选中内容样式为 标题5",formatH6:"设置选中内容样式为 标题6",insertHorizontalRule:"插入水平线","linkDialog.show":"显示链接对话框"},history:{undo:"撤销",redo:"重做"},specialChar:{specialChar:"特殊字符",select:"选取特殊字符"}}})}(jQuery);

File diff suppressed because one or more lines are too long

@ -1,11 +1,11 @@
/**
* Super simple wysiwyg editor v0.8.11
* Super simple wysiwyg editor v0.8.12
* https://summernote.org
*
* Copyright 2013- Alan Hong. and other contributors
* summernote may be freely distributed under the MIT license.
*
* Date: 2018-12-22T04:42Z
* Date: 2019-05-16T08:16Z
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
@ -61,7 +61,7 @@
create: function (markup, callback) {
return function () {
var options = typeof arguments[1] === 'object' ? arguments[1] : arguments[0];
var children = $$1.isArray(arguments[0]) ? arguments[0] : [];
var children = Array.isArray(arguments[0]) ? arguments[0] : [];
if (options && options.children) {
children = options.children;
}
@ -92,13 +92,13 @@
].join(''));
var buttonGroup = renderer.create('<div class="note-btn-group btn-group">');
var dropdown = renderer.create('<ul class="dropdown-menu" role="list">', function ($node, options) {
var markup = $$1.isArray(options.items) ? options.items.map(function (item) {
var markup = Array.isArray(options.items) ? options.items.map(function (item) {
var value = (typeof item === 'string') ? item : (item.value || '');
var content = options.template ? options.template(item) : item;
var option = (typeof item === 'object') ? item.option : undefined;
var dataValue = 'data-value="' + value + '"';
var dataOption = (option !== undefined) ? ' data-option="' + option + '"' : '';
return '<li role="listitem" aria-label="' + item + '"><a href="#" ' + (dataValue + dataOption) + '>' + content + '</a></li>';
return '<li role="listitem" aria-label="' + value + '"><a href="#" ' + (dataValue + dataOption) + '>' + content + '</a></li>';
}).join('') : options.items;
$node.html(markup).attr({ 'aria-label': options.title });
});
@ -106,7 +106,7 @@
return contents + ' ' + icon(options.icons.caret, 'span');
};
var dropdownCheck = renderer.create('<ul class="dropdown-menu note-check" role="list">', function ($node, options) {
var markup = $$1.isArray(options.items) ? options.items.map(function (item) {
var markup = Array.isArray(options.items) ? options.items.map(function (item) {
var value = (typeof item === 'string') ? item : (item.value || '');
var content = options.template ? options.template(item) : item;
return '<li role="listitem" aria-label="' + item + '"><a href="#" data-value="' + value + '">' + icon(options.checkClassName) + ' ' + content + '</a></li>';
@ -470,38 +470,6 @@
}
var isEdge = /Edge\/\d+/.test(userAgent);
var hasCodeMirror = !!window.CodeMirror;
if (!hasCodeMirror && isSupportAmd) {
// Webpack
if (typeof __webpack_require__ === 'function') { // eslint-disable-line
try {
// If CodeMirror can't be resolved, `require.resolve` will throw an
// exception and `hasCodeMirror` won't be set to `true`.
require.resolve('codemirror');
hasCodeMirror = true;
}
catch (e) {
// do nothing
}
}
else if (typeof require !== 'undefined') {
// Browserify
if (typeof require.resolve !== 'undefined') {
try {
// If CodeMirror can't be resolved, `require.resolve` will throw an
// exception and `hasCodeMirror` won't be set to `true`.
require.resolve('codemirror');
hasCodeMirror = true;
}
catch (e) {
// do nothing
}
// Almond/Require
}
else if (typeof require.specified !== 'undefined') {
hasCodeMirror = require.specified('codemirror');
}
}
}
var isSupportTouch = (('ontouchstart' in window) ||
(navigator.MaxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0));
@ -747,17 +715,14 @@
}
return true;
}
/**
* returns index of item
*/
function indexOf(array, item) {
return $$1.inArray(item, array);
}
/**
* returns true if the value is present in the list.
*/
function contains(array, item) {
return indexOf(array, item) !== -1;
if (array && array.length && item) {
return array.indexOf(item) !== -1;
}
return false;
}
/**
* get sum from a list
@ -847,22 +812,22 @@
* @param {Array} array
*/
function next(array, item) {
var idx = indexOf(array, item);
if (idx === -1) {
return null;
if (array && array.length && item) {
var idx = array.indexOf(item);
return idx === -1 ? null : array[idx + 1];
}
return array[idx + 1];
return null;
}
/**
* returns prev item.
* @param {Array} array
*/
function prev(array, item) {
var idx = indexOf(array, item);
if (idx === -1) {
return null;
if (array && array.length && item) {
var idx = array.indexOf(item);
return idx === -1 ? null : array[idx - 1];
}
return array[idx - 1];
return null;
}
/**
* @class core.list
@ -1156,10 +1121,9 @@
function commonAncestor(nodeA, nodeB) {
var ancestors = listAncestor(nodeA);
for (var n = nodeB; n; n = n.parentNode) {
if ($$1.inArray(n, ancestors) > -1) {
if (ancestors.indexOf(n) > -1)
return n;
}
}
return null; // difference document area
}
/**
@ -1762,7 +1726,7 @@
var isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);
return match + ((isEndOfInlineContainer || isBlockNode) ? '\n' : '');
});
markup = $$1.trim(markup);
markup = markup.trim();
}
return markup;
}
@ -2242,8 +2206,8 @@
WrappedRange.prototype.nativeRange = function () {
if (env.isW3CRangeSupport) {
var w3cRange = document.createRange();
w3cRange.setStart(this.sc, this.so);
w3cRange.setEnd(this.ec, this.eo);
w3cRange.setStart(this.sc, this.sc.data && this.so > this.sc.data.length ? 0 : this.so);
w3cRange.setEnd(this.ec, this.sc.data ? Math.min(this.eo, this.sc.data.length) : this.eo);
return w3cRange;
}
else {
@ -2313,16 +2277,28 @@
WrappedRange.prototype.normalize = function () {
/**
* @param {BoundaryPoint} point
* @param {Boolean} isLeftToRight
* @param {Boolean} isLeftToRight - true: prefer to choose right node
* - false: prefer to choose left node
* @return {BoundaryPoint}
*/
var getVisiblePoint = function (point, isLeftToRight) {
if ((dom.isVisiblePoint(point) && !dom.isEdgePoint(point)) ||
(dom.isVisiblePoint(point) && dom.isRightEdgePoint(point) && !isLeftToRight) ||
(dom.isVisiblePoint(point) && dom.isLeftEdgePoint(point) && isLeftToRight) ||
(dom.isVisiblePoint(point) && dom.isBlock(point.node) && dom.isEmpty(point.node))) {
// Just use the given point [XXX:Adhoc]
// - case 01. if the point is on the middle of the node
// - case 02. if the point is on the right edge and prefer to choose left node
// - case 03. if the point is on the left edge and prefer to choose right node
// - case 04. if the point is on the right edge and prefer to choose right node but the node is void
// - case 05. if the point is on the left edge and prefer to choose left node but the node is void
// - case 06. if the point is on the block node and there is no children
if (dom.isVisiblePoint(point)) {
if (!dom.isEdgePoint(point) ||
(dom.isRightEdgePoint(point) && !isLeftToRight) ||
(dom.isLeftEdgePoint(point) && isLeftToRight) ||
(dom.isRightEdgePoint(point) && isLeftToRight && dom.isVoid(point.node.nextSibling)) ||
(dom.isLeftEdgePoint(point) && !isLeftToRight && dom.isVoid(point.node.previousSibling)) ||
(dom.isBlock(point.node) && dom.isEmpty(point.node))) {
return point;
}
}
// point on block's edge
var block = dom.ancestor(point.node, dom.isBlock);
if (((dom.isLeftEdgePointOf(point, block) || dom.isVoid(dom.prevPoint(point).node)) && !isLeftToRight) ||
@ -3164,7 +3140,7 @@
}
else {
var orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square'];
var isUnordered = $$1.inArray(styleInfo['list-style-type'], orderedTypes) > -1;
var isUnordered = orderedTypes.indexOf(styleInfo['list-style-type']) > -1;
styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered';
}
var para = dom.ancestor(rng.sc, dom.isPara);
@ -4723,9 +4699,13 @@
};
Editor.prototype.onFormatBlock = function (tagName, $target) {
// [workaround] for MSIE, IE need `<`
tagName = env.isMSIE ? '<' + tagName + '>' : tagName;
document.execCommand('FormatBlock', false, tagName);
document.execCommand('FormatBlock', false, env.isMSIE ? '<' + tagName + '>' : tagName);
// support custom class
if ($target && $target.length) {
// find the exact element has given tagName
if ($target[0].tagName.toUpperCase() !== tagName.toUpperCase()) {
$target = $target.find(tagName);
}
if ($target && $target.length) {
var className = $target[0].className || '';
if (className) {
@ -4734,6 +4714,7 @@
$parent.addClass(className);
}
}
}
};
Editor.prototype.formatPara = function () {
this.formatBlock('P');
@ -5035,15 +5016,8 @@
var CodeMirror;
if (env.hasCodeMirror) {
if (env.isSupportAmd) {
require(['codemirror'], function (cm) {
CodeMirror = cm;
});
}
else {
CodeMirror = window.CodeMirror;
}
}
/**
* @class Codeview
*/
@ -5099,7 +5073,7 @@
for (var _i = 0, whitelist_2 = whitelist_1; _i < whitelist_2.length; _i++) {
var src = whitelist_2[_i];
// pass if src is trusted
if ((new RegExp('src="(https?:)?\/\/' + src + '\/(.+)"')).test(tag)) {
if ((new RegExp('src="(https?:)?\/\/' + src.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\/(.+)"')).test(tag)) {
return tag;
}
}
@ -5273,7 +5247,7 @@
this.lang = this.options.langInfo;
this.events = {
'summernote.mousedown': function (we, e) {
if (_this.update(e.target)) {
if (_this.update(e.target, e)) {
e.preventDefault();
}
},
@ -5339,13 +5313,13 @@
Handle.prototype.destroy = function () {
this.$handle.remove();
};
Handle.prototype.update = function (target) {
Handle.prototype.update = function (target, event) {
if (this.context.isDisabled()) {
return false;
}
var isImage = dom.isImg(target);
var $selection = this.$handle.find('.note-control-selection');
this.context.invoke('imagePopover.update', target);
this.context.invoke('imagePopover.update', target, event);
if (isImage) {
var $image = $$1(target);
var position = $image.position();
@ -5621,7 +5595,7 @@
Buttons.prototype.isFontDeservedToAdd = function (name) {
var genericFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];
name = name.toLowerCase();
return ((name !== '') && this.isFontInstalled(name) && ($$1.inArray(name, genericFamilies) === -1));
return (name !== '' && this.isFontInstalled(name) && genericFamilies.indexOf(name) === -1);
};
Buttons.prototype.colorPalette = function (className, tooltip, backColor, foreColor) {
var _this = this;
@ -5886,7 +5860,7 @@
$$1.each(styleInfo['font-family'].split(','), function (idx, fontname) {
fontname = fontname.trim().replace(/['"]+/g, '');
if (_this.isFontDeservedToAdd(fontname)) {
if ($$1.inArray(fontname, _this.options.fontNames) === -1) {
if (_this.options.fontNames.indexOf(fontname) === -1) {
_this.options.fontNames.push(fontname);
}
}
@ -6284,8 +6258,8 @@
Buttons.prototype.build = function ($container, groups) {
for (var groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) {
var group = groups[groupIdx];
var groupName = $$1.isArray(group) ? group[0] : group;
var buttons = $$1.isArray(group) ? ((group.length === 1) ? [group[0]] : group[1]) : [group];
var groupName = Array.isArray(group) ? group[0] : group;
var buttons = Array.isArray(group) ? ((group.length === 1) ? [group[0]] : group[1]) : [group];
var $group = this.ui.buttonGroup({
className: 'note-' + groupName
}).render();
@ -6606,30 +6580,23 @@
.find('.sn-checkbox-open-in-new-window input[type=checkbox]');
_this.ui.onDialogShown(_this.$dialog, function () {
_this.context.triggerEvent('dialog.shown');
// if no url was given and given text is valid URL then copy that into URL Field
// If no url was given and given text is valid URL then copy that into URL Field
if (!linkInfo.url && func.isValidUrl(linkInfo.text)) {
linkInfo.url = linkInfo.text;
}
$linkText.val(linkInfo.text);
var handleLinkTextUpdate = function () {
_this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
// if linktext was modified by keyup,
// stop cloning text from linkUrl
$linkText.on('input paste propertychange', function () {
// If linktext was modified by input events,
// cloning text from linkUrl will be stopped.
linkInfo.text = $linkText.val();
};
$linkText.on('input', handleLinkTextUpdate).on('paste', function () {
setTimeout(handleLinkTextUpdate, 0);
});
var handleLinkUrlUpdate = function () {
_this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
// display same link on `Text to display` input
// when create a new link
}).val(linkInfo.text);
$linkUrl.on('input paste propertychange', function () {
// Display same text on `Text to display` as default
// when linktext has no text
if (!linkInfo.text) {
$linkText.val($linkUrl.val());
}
};
$linkUrl.on('input', handleLinkUrlUpdate).on('paste', function () {
setTimeout(handleLinkUrlUpdate, 0);
_this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
}).val(linkInfo.url);
if (!env.isSupportTouch) {
$linkUrl.trigger('focus');
@ -6653,9 +6620,9 @@
});
_this.ui.onDialogHidden(_this.$dialog, function () {
// detach events
$linkText.off('input paste keypress');
$linkUrl.off('input paste keypress');
$linkBtn.off('click');
$linkText.off();
$linkUrl.off();
$linkBtn.off();
if (deferred.state() === 'pending') {
deferred.reject();
}
@ -6833,23 +6800,22 @@
$imageInput.replaceWith($imageInput.clone().on('change', function (event) {
deferred.resolve(event.target.files || event.target.value);
}).val(''));
$imageBtn.click(function (event) {
event.preventDefault();
deferred.resolve($imageUrl.val());
});
$imageUrl.on('keyup paste', function () {
var url = $imageUrl.val();
_this.ui.toggleBtn($imageBtn, url);
$imageUrl.on('input paste propertychange', function () {
_this.ui.toggleBtn($imageBtn, $imageUrl.val());
}).val('');
if (!env.isSupportTouch) {
$imageUrl.trigger('focus');
}
$imageBtn.click(function (event) {
event.preventDefault();
deferred.resolve($imageUrl.val());
});
_this.bindEnterKey($imageUrl, $imageBtn);
});
_this.ui.onDialogHidden(_this.$dialog, function () {
$imageInput.off('change');
$imageUrl.off('keyup paste keypress');
$imageBtn.off('click');
$imageInput.off();
$imageUrl.off();
$imageBtn.off();
if (deferred.state() === 'pending') {
deferred.reject();
}
@ -6891,7 +6857,7 @@
ImagePopover.prototype.destroy = function () {
this.$popover.remove();
};
ImagePopover.prototype.update = function (target) {
ImagePopover.prototype.update = function (target, event) {
if (dom.isImg(target)) {
var pos = dom.posFromPlaceholder(target);
var posEditor = dom.posFromPlaceholder(this.editable);
@ -7145,7 +7111,7 @@
var $videoBtn = _this.$dialog.find('.note-video-btn');
_this.ui.onDialogShown(_this.$dialog, function () {
_this.context.triggerEvent('dialog.shown');
$videoUrl.val(text).on('input', function () {
$videoUrl.on('input paste propertychange', function () {
_this.ui.toggleBtn($videoBtn, $videoUrl.val());
});
if (!env.isSupportTouch) {
@ -7158,8 +7124,8 @@
_this.bindEnterKey($videoUrl, $videoBtn);
});
_this.ui.onDialogHidden(_this.$dialog, function () {
$videoUrl.off('input');
$videoBtn.off('click');
$videoUrl.off();
$videoBtn.off();
if (deferred.state() === 'pending') {
deferred.reject();
}
@ -7183,7 +7149,7 @@
var $container = this.options.dialogsInBody ? this.$body : this.$editor;
var body = [
'<p class="text-center">',
'<a href="http://summernote.org/" target="_blank">Summernote 0.8.11</a> · ',
'<a href="http://summernote.org/" target="_blank">Summernote 0.8.12</a> · ',
'<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ',
'<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',
'</p>',
@ -7316,7 +7282,7 @@
this.options = context.options;
this.hint = this.options.hint || [];
this.direction = this.options.hintDirection || 'bottom';
this.hints = $$1.isArray(this.hint) ? this.hint : [this.hint];
this.hints = Array.isArray(this.hint) ? this.hint : [this.hint];
this.events = {
'summernote.keyup': function (we, e) {
if (!e.isDefaultPrevented()) {
@ -7507,7 +7473,7 @@
}());
$$1.summernote = $$1.extend($$1.summernote, {
version: '0.8.11',
version: '0.8.12',
plugins: {},
dom: dom,
range: range,
@ -7541,7 +7507,7 @@
},
buttons: {},
lang: 'en-US',
followingToolbar: true,
followingToolbar: false,
otherStaticBar: '',
// toolbar
toolbar: [
@ -7667,7 +7633,8 @@
codeviewIframeFilter: true,
codeviewIframeWhitelistSrc: [],
codeviewIframeWhitelistSrcBase: [
'www.youtube(?:-nocookie)?.com',
'www.youtube.com',
'www.youtube-nocookie.com',
'www.facebook.com',
'vine.co',
'instagram.com',

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save