Socket
Socket
Sign inDemoInstall

summernote

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

summernote - npm Package Compare versions

Comparing version 0.6.13 to 0.6.14

dist/dist/plugin/summernote-ext-hello.js

6

lang/summernote-de-DE.js

@@ -22,4 +22,10 @@ (function ($) {

floatNone: 'Kein Textfluss',
shapeRounded: 'Rahmen: Abgerundet',
shapeCircle: 'Rahmen: Kreisförmig',
shapeThumbnail: 'Rahmen: Thumbnail',
shapeNone: 'Kein Rahmen',
dragImageHere: 'Ziehen Sie ein Bild mit der Maus hierher',
selectFromFiles: 'Wählen Sie eine Datei aus',
maximumFileSize: 'Maximale Dateigröße',
maximumFileSizeError: 'Maximale Dateigröße überschritten',
url: 'Grafik URL',

@@ -26,0 +32,0 @@ remove: 'Grafik entfernen'

28

lang/summernote-zh-CN.js

@@ -12,2 +12,4 @@ (function ($) {

strikethrough: '删除线',
subscript: '下标',
superscript: '上标',
size: '字号'

@@ -18,11 +20,18 @@ },

insert: '插入图片',
resizeFull: '调整至 100%',
resizeHalf: '调整至 50%',
resizeQuarter: '调整至 25%',
floatLeft: '左浮动',
floatRight: '右浮动',
floatNone: '不浮动',
dragImageHere: '将图片拖至此处',
resizeFull: '缩放至 100%',
resizeHalf: '缩放至 50%',
resizeQuarter: '缩放至 25%',
floatLeft: '靠左浮动',
floatRight: '靠右浮动',
floatNone: '取消浮动',
shapeRounded: '形状: 圆角',
shapeCircle: '形状: 圆',
shapeThumbnail: '形状: 缩略图',
shapeNone: '形状: 无',
dragImageHere: '将图片拖拽至此处',
selectFromFiles: '从本地上传',
url: '图片地址'
maximumFileSize: '文件大小最大值',
maximumFileSizeError: '文件大小超出最大值。',
url: '图片地址',
remove: '移除图片'
},

@@ -90,3 +99,4 @@ link: {

paragraphFormatting: '段落格式',
documentStyle: '文档样式'
documentStyle: '文档样式',
extraKeys: '额外按键'
},

@@ -93,0 +103,0 @@ history: {

@@ -10,4 +10,7 @@ (function ($) {

height: '行高',
name: '字體',
strikethrough: '刪除線',
size: '字體大小'
subscript: '下標',
superscript: '上標',
size: '字號'
},

@@ -23,5 +26,12 @@ image: {

floatNone: '取消浮動',
shapeRounded: '形狀: 圓角',
shapeCircle: '形狀: 圓',
shapeThumbnail: '形狀: 縮略圖',
shapeNone: '形狀: 無',
dragImageHere: '將圖片拖曳至此處',
selectFromFiles: '從本機上傳',
url: '圖片網址'
maximumFileSize: '文件大小最大值',
maximumFileSizeError: '文件大小超出最大值。',
url: '圖片網址',
remove: '移除圖片'
},

@@ -89,3 +99,4 @@ link: {

paragraphFormatting: '段落格式',
documentStyle: '文件格式'
documentStyle: '文件格式',
extraKeys: '額外按鍵'
},

@@ -92,0 +103,0 @@ history: {

{
"name": "summernote",
"description": "Super Simple WYSIWYG Editor on Bootstrap",
"version": "0.6.13",
"version": "0.6.14",
"keywords": [

@@ -18,2 +18,3 @@ "editor",

},
"main": "dist/summernote.js",
"devDependencies": {

@@ -20,0 +21,0 @@ "connect-livereload": "*",

@@ -44,6 +44,6 @@ # Summernote

<!-- include libraries(jQuery, bootstrap, fontawesome) -->
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />

@@ -50,0 +50,0 @@ <!-- include summernote css/js-->

@@ -159,3 +159,3 @@ define([

var isVoid = function (node) {
return node && /^BR|^IMG|^HR/.test(node.nodeName.toUpperCase());
return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON/.test(node.nodeName.toUpperCase());
};

@@ -183,2 +183,3 @@

!isList(node) &&
!isHr(node) &&
!isPara(node) &&

@@ -193,2 +194,4 @@ !isTable(node) &&

var isHr = makePredByNodeName('HR');
var isCell = function (node) {

@@ -195,0 +198,0 @@ return node && /^TD|^TH/.test(node.nodeName.toUpperCase());

@@ -210,4 +210,4 @@ define([

var block = dom.ancestor(point.node, dom.isBlock);
if ((dom.isLeftEdgePointOf(point, block) && !isLeftToRight) ||
(dom.isRightEdgePointOf(point, block) && isLeftToRight)) {
if (((dom.isLeftEdgePointOf(point, block) || dom.isVoid(dom.prevPoint(point).node)) && !isLeftToRight) ||
((dom.isRightEdgePointOf(point, block) || dom.isVoid(dom.nextPoint(point).node)) && isLeftToRight)) {

@@ -214,0 +214,0 @@ // returns point already on visible point

@@ -50,5 +50,8 @@ define('summernote/defaults', function () {

disableResizeEditor: false, // disable resizing editor
disableResizeImage: false, // disable resizing image
shortcuts: true, // enable keyboard shortcuts
textareaAutoSync: true, // enable textarea auto sync
placeholder: false, // enable placeholder text

@@ -55,0 +58,0 @@ prettifyHtml: true, // enable prettifying html while toggling codeview

@@ -35,2 +35,7 @@ define(['summernote/core/range'], function (range) {

this.undo = function () {
// Create snap shot if not yet recorded
if ($editable.html() !== stack[stackOffset].contents) {
this.recordUndo();
}
if (0 < stackOffset) {

@@ -37,0 +42,0 @@ stackOffset--;

@@ -39,2 +39,15 @@ define([

/**
* returns style object from node
*
* @param {jQuery} $node
* @return {Object}
*/
this.fromNode = function ($node) {
var properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];
var styleInfo = jQueryCSS($node, properties) || {};
styleInfo['font-size'] = parseInt(styleInfo['font-size'], 10);
return styleInfo;
};
/**
* paragraph level style

@@ -109,12 +122,8 @@ *

* @param {WrappedRange} rng
* @param {Node} target - target element on event
* @return {Object} - object contains style properties.
*/
this.current = function (rng, target) {
this.current = function (rng) {
var $cont = $(dom.isText(rng.sc) ? rng.sc.parentNode : rng.sc);
var properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];
var styleInfo = jQueryCSS($cont, properties) || {};
var styleInfo = this.fromNode($cont);
styleInfo['font-size'] = parseInt(styleInfo['font-size'], 10);
// document.queryCommandState for toggle state

@@ -145,3 +154,2 @@ styleInfo['font-bold'] = document.queryCommandState('bold') ? 'bold' : 'normal';

styleInfo.image = dom.isImg(target) && target;
styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor);

@@ -148,0 +156,0 @@ styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable);

@@ -32,2 +32,4 @@ define([

var EventHandler = function () {
var self = this;
/**

@@ -184,16 +186,27 @@ * Modules

/**
* update sytle info
* @param {Object} styleInfo
* @param {Object} layoutInfo
*/
this.updateStyleInfo = function (styleInfo, layoutInfo) {
if (!styleInfo) {
return;
}
var isAirMode = layoutInfo.editor().data('options').airMode;
if (!isAirMode) {
modules.toolbar.update(layoutInfo.toolbar(), styleInfo);
}
modules.popover.update(layoutInfo.popover(), styleInfo, isAirMode);
modules.handle.update(layoutInfo.handle(), styleInfo, isAirMode);
};
var hToolbarAndPopoverUpdate = function (event) {
var target = event.target;
// delay for range after mouseup
setTimeout(function () {
var layoutInfo = dom.makeLayoutInfo(event.currentTarget || event.target);
var styleInfo = modules.editor.currentStyle(event.target);
if (!styleInfo) { return; }
var isAirMode = layoutInfo.editor().data('options').airMode;
if (!isAirMode) {
modules.toolbar.update(layoutInfo.toolbar(), styleInfo);
}
modules.popover.update(layoutInfo.popover(), styleInfo, isAirMode);
modules.handle.update(layoutInfo.handle(), styleInfo, isAirMode);
var layoutInfo = dom.makeLayoutInfo(target);
var styleInfo = modules.editor.currentStyle(target);
self.updateStyleInfo(styleInfo, layoutInfo);
}, 0);

@@ -220,43 +233,45 @@ };

if ($btn.length) {
var eventName = $btn.attr('data-event'),
value = $btn.attr('data-value'),
hide = $btn.attr('data-hide');
if (!$btn.length) {
return;
}
var layoutInfo = dom.makeLayoutInfo(event.target);
var eventName = $btn.attr('data-event'),
value = $btn.attr('data-value'),
hide = $btn.attr('data-hide');
// before command: detect control selection element($target)
var $target;
if ($.inArray(eventName, ['resize', 'floatMe', 'removeMedia', 'imageShape']) !== -1) {
var $selection = layoutInfo.handle().find('.note-control-selection');
$target = $($selection.data('target'));
}
var layoutInfo = dom.makeLayoutInfo(event.target);
// If requested, hide the popover when the button is clicked.
// Useful for things like showHelpDialog.
if (hide) {
$btn.parents('.popover').hide();
}
// before command: detect control selection element($target)
var $target;
if ($.inArray(eventName, ['resize', 'floatMe', 'removeMedia', 'imageShape']) !== -1) {
var $selection = layoutInfo.handle().find('.note-control-selection');
$target = $($selection.data('target'));
}
if ($.isFunction($.summernote.pluginEvents[eventName])) {
$.summernote.pluginEvents[eventName](event, modules.editor, layoutInfo, value);
} else if (modules.editor[eventName]) { // on command
var $editable = layoutInfo.editable();
$editable.focus();
modules.editor[eventName]($editable, value, $target);
event.preventDefault();
} else if (commands[eventName]) {
commands[eventName].call(this, layoutInfo);
event.preventDefault();
}
// If requested, hide the popover when the button is clicked.
// Useful for things like showHelpDialog.
if (hide) {
$btn.parents('.popover').hide();
}
// after command
if ($.inArray(eventName, ['backColor', 'foreColor']) !== -1) {
var options = layoutInfo.editor().data('options', options);
var module = options.airMode ? modules.popover : modules.toolbar;
module.updateRecentColor(list.head($btn), eventName, value);
}
if ($.isFunction($.summernote.pluginEvents[eventName])) {
$.summernote.pluginEvents[eventName](event, modules.editor, layoutInfo, value);
} else if (modules.editor[eventName]) { // on command
var $editable = layoutInfo.editable();
$editable.focus();
modules.editor[eventName]($editable, value, $target);
event.preventDefault();
} else if (commands[eventName]) {
commands[eventName].call(this, layoutInfo);
event.preventDefault();
}
hToolbarAndPopoverUpdate(event);
// after command
if ($.inArray(eventName, ['backColor', 'foreColor']) !== -1) {
var options = layoutInfo.editor().data('options', options);
var module = options.airMode ? modules.popover : modules.toolbar;
module.updateRecentColor(list.head($btn), eventName, value);
}
hToolbarAndPopoverUpdate(event);
};

@@ -442,8 +457,4 @@

// Textarea: auto filling the code before form submit.
if (dom.isTextarea(list.head(layoutInfo.holder()))) {
layoutInfo.holder().closest('form').submit(function () {
layoutInfo.holder().val(layoutInfo.holder().code());
});
}
var styleInfo = modules.editor.styleFromNode(layoutInfo.editable());
this.updateStyleInfo(styleInfo, layoutInfo);
};

@@ -493,2 +504,3 @@

$holder.closest('form').submit(function (e) {
layoutInfo.holder().val(layoutInfo.holder().code());
bindCustomEvent($holder, callbacks, 'submit').call(this, e, $holder.code());

@@ -498,2 +510,9 @@ });

// textarea auto sync
if (dom.isTextarea(list.head($holder)) && options.textareaAutoSync) {
$holder.on('summernote.change', function () {
layoutInfo.holder().val(layoutInfo.holder().code());
});
}
// fire init event

@@ -500,0 +519,0 @@ bindCustomEvent($holder, callbacks, 'init')(layoutInfo);

@@ -11,3 +11,6 @@ define([

this.attach = function (layoutInfo) {
if (window.clipboardData || agent.isFF) {
// [workaround] getting image from clipboard
// - IE11 and Firefox: CTRL+v hook
// - Webkit: event.clipboardData
if ((agent.isMSIE && agent.browserVersion > 10) || agent.isFF) {
$paste = $('<div />').attr('contenteditable', true).css({

@@ -18,4 +21,2 @@ position : 'absolute',

});
layoutInfo.editable().after($paste);
$paste.on('paste', hPaste);

@@ -26,15 +27,52 @@ layoutInfo.editable().on('keydown', function (e) {

$paste.focus();
setTimeout(function () {
pasteByHook(layoutInfo);
}, 0);
}
});
layoutInfo.editable().before($paste);
} else {
layoutInfo.editable().on('paste', pasteByEvent);
}
};
layoutInfo.editable().on('paste', hPaste);
var pasteByHook = function (layoutInfo) {
var $editable = layoutInfo.editable();
var node = $paste[0].firstChild;
if (dom.isImg(node)) {
var dataURI = node.src;
var decodedData = atob(dataURI.split(',')[1]);
var array = new Uint8Array(decodedData.length);
for (var i = 0; i < decodedData.length; i++) {
array[i] = decodedData.charCodeAt(i);
}
var blob = new Blob([array], { type : 'image/png' });
blob.name = 'clipboard.png';
handler.invoke('restoreRange', $editable);
handler.invoke('focus', $editable);
handler.insertImages(layoutInfo, [blob]);
} else {
var pasteContent = $('<div />').html($paste.html()).html();
handler.invoke('restoreRange', $editable);
handler.invoke('focus', $editable);
if (pasteContent) {
handler.invoke('pasteHTML', $editable, pasteContent);
}
}
$paste.empty();
};
/**
* paste clipboard image
* paste by clipboard event
*
* @param {Event} event
*/
var hPaste = function (event) {
var pasteByEvent = function (event) {
var clipboardData = event.originalEvent.clipboardData;

@@ -45,3 +83,2 @@ var layoutInfo = dom.makeLayoutInfo(event.currentTarget || event.target);

if (clipboardData && clipboardData.items && clipboardData.items.length) {
// using clipboardData case
var item = list.head(clipboardData.items);

@@ -51,31 +88,3 @@ if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {

}
handler.invoke('editor.afterCommand', $editable);
} else if ($paste && $editable.data('callbacks').onImageUpload) {
// using dummy contenteditable: only can run if it has onImageUpload method
setTimeout(function () {
var node = $paste[0].firstChild;
if (dom.isImg(node)) {
handler.invoke('restoreRange', $editable);
var dataURI = node.src;
var decodedData = atob(dataURI.split(',')[1]);
var array = new Uint8Array(decodedData.length);
for (var i = 0; i < decodedData.length; i++) {
array[i] = decodedData.charCodeAt(i);
}
var blob = new Blob([array], { type : 'image/png' });
blob.name = 'clipboard.png';
handler.invoke('focus', $editable);
handler.insertImages(layoutInfo, [blob]);
$paste.empty();
} else {
var pasteContent = $('<div />').html($paste.html());
handler.invoke('restoreRange', $editable);
handler.invoke('focus', $editable);
handler.invoke('pasteHTML', $editable, pasteContent.html());
$paste.empty();
}
}, 0);
}

@@ -82,0 +91,0 @@ };

@@ -105,2 +105,3 @@ define([

};
/**

@@ -112,9 +113,23 @@ * @method currentStyle

* @param {Node} target
* @return {Boolean} false if range is no
* @return {Object|Boolean} unfocus
*/
this.currentStyle = function (target) {
var rng = range.create();
return rng && rng.isOnEditable() ? style.current(rng.normalize(), target) : false;
var styleInfo = rng && rng.isOnEditable() ? style.current(rng.normalize()) : {};
if (dom.isImg(target)) {
styleInfo.image = target;
}
return styleInfo;
};
/**
* style from node
*
* @param {jQuery} $node
* @return {Object}
*/
this.styleFromNode = function ($node) {
return style.fromNode($node);
};
var triggerOnBeforeChange = function ($editable) {

@@ -290,3 +305,3 @@ var $holder = dom.makeLayoutInfo($editable).holder();

'formatBlock', 'removeFormat',
'backColor', 'foreColor', 'insertHorizontalRule', 'fontName'];
'backColor', 'foreColor', 'fontName'];

@@ -514,2 +529,18 @@ for (var idx = 0, len = commands.length; idx < len; idx ++) {

/**
* insert horizontal rule
* @param {jQuery} $editable
*/
this.insertHorizontalRule = function ($editable) {
beforeCommand($editable);
var rng = range.create();
var hrNode = rng.insertNode($('<HR/>')[0]);
if (hrNode.nextSibling) {
range.create(hrNode.nextSibling, 0).normalize().select();
}
afterCommand($editable);
};
/**
* remove bogus node and character

@@ -580,3 +611,3 @@ */

var linkText = linkInfo.text;
var isNewWindow = linkInfo.newWindow;
var isNewWindow = linkInfo.isNewWindow;
var rng = linkInfo.range || this.createRange($editable);

@@ -699,2 +730,9 @@ var isTextChanged = rng.toString() !== linkText;

beforeCommand($editable);
// bootstrap
$target.removeClass('pull-left pull-right');
if (value && value !== 'none') {
$target.addClass('pull-' + value);
}
// fallback for non-bootstrap
$target.css('float', value);

@@ -701,0 +739,0 @@ afterCommand($editable);

@@ -78,3 +78,3 @@ define([

$openInNewWindow.prop('checked', linkInfo.newWindow);
$openInNewWindow.prop('checked', linkInfo.isNewWindow);

@@ -88,3 +88,3 @@ $linkBtn.one('click', function (event) {

text: $linkText.val(),
newWindow: $openInNewWindow.is(':checked')
isNewWindow: $openInNewWindow.is(':checked')
});

@@ -91,0 +91,0 @@ $linkDialog.modal('hide');

@@ -474,3 +474,3 @@ define([

var content = '<div class="btn-group">' + fullButton + halfButton + quarterButton + '</div>' +
var content = (options.disableResizeImage ? '' : '<div class="btn-group">' + fullButton + halfButton + quarterButton + '</div>') +
'<div class="btn-group">' + leftButton + rightButton + justifyButton + '</div><br>' +

@@ -513,3 +513,3 @@ '<div class="btn-group">' + roundedButton + circleButton + thumbnailButton + noneButton + '</div>' +

var tplHandles = function () {
var tplHandles = function (options) {
return '<div class="note-handle">' +

@@ -521,4 +521,6 @@ '<div class="note-control-selection">' +

'<div class="note-control-holder note-control-sw"></div>' +
'<div class="note-control-sizing note-control-se"></div>' +
'<div class="note-control-selection-info"></div>' +
'<div class="' +
(options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing') +
' note-control-se"></div>' +
(options.disableResizeImage ? '' : '<div class="note-control-selection-info"></div>') +
'</div>' +

@@ -647,3 +649,3 @@ '</div>';

'<label>' + lang.image.selectFromFiles + '</label>' +
'<input class="note-image-input" type="file" name="files" accept="image/*" multiple="multiple" />' +
'<input class="note-image-input form-control" type="file" name="files" accept="image/*" multiple="multiple" />' +
imageLimitation +

@@ -865,3 +867,3 @@ '</div>' +

//05. handle(control selection, ...)
$(tplHandles()).prependTo($editingArea);
$(tplHandles(options)).prependTo($editingArea);

@@ -868,0 +870,0 @@ $editingArea.prependTo($editor);

@@ -225,3 +225,2 @@ define([

eventHandler.attachCustomEvent(layoutInfo, options);
}

@@ -228,0 +227,0 @@ });

@@ -146,3 +146,16 @@ /**

test('rng.normalize (void element)', function () {
var rng, $cont, $p, $b;
$cont = $('<div><p><img><b>bold</b></p></div>');
$p = $cont.find('p');
$b = $cont.find('b');
rng = range.create($p[0], 1, $p[0], 1).normalize();
deepEqual([
rng.sc, rng.so, rng.ec, rng.eo
], [
$b[0].firstChild, 0, $b[0].firstChild, 0
], 'rng.normalize on `<p><img>|<b>bold</b></p>` should returns `<p><img>|<b>bold</b></p>`');
});
test('rng.insertNode', function () {

@@ -149,0 +162,0 @@ var $cont, $p, $p2, $b, $u;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc