summernote
Advanced tools
Comparing version 0.6.5 to 0.6.6
{ | ||
"name": "summernote", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "./dist/summernote.js", |
{ | ||
"name": "summernote", | ||
"description": "Super Simple WYSIWYG Editor on Bootstrap", | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"keywords": [ | ||
@@ -30,7 +30,5 @@ "editor", | ||
"grunt-exec": "^0.4.6", | ||
"connect-livereload": "*" | ||
}, | ||
"dependencies": { | ||
"connect-livereload": "*", | ||
"open": "0.0.4" | ||
} | ||
} |
@@ -40,4 +40,74 @@ require.config({ | ||
theme: 'monokai' | ||
}, | ||
onInit: function () { | ||
console.log('init', arguments, $('.summernote')[0] === this); | ||
}, | ||
onFocus: function () { | ||
console.log('focus', arguments, $('.summernote')[0] === this); | ||
}, | ||
onBlur: function () { | ||
console.log('blur', arguments, $('.summernote')[0] === this); | ||
}, | ||
onKeydown: function () { | ||
console.log('keydown', arguments, $('.summernote')[0] === this); | ||
}, | ||
onKeyup: function () { | ||
console.log('keyup', arguments, $('.summernote')[0] === this); | ||
}, | ||
onEnter: function () { | ||
console.log('enter', arguments, $('.summernote')[0] === this); | ||
}, | ||
onMousedown: function () { | ||
console.log('onMousedown', arguments, $('.summernote')[0] === this); | ||
}, | ||
onMouseup: function () { | ||
console.log('onMouseup', arguments, $('.summernote')[0] === this); | ||
}, | ||
onScroll: function () { | ||
console.log('onscroll', arguments, $('.summernote')[0] === this); | ||
}, | ||
onPaste: function () { | ||
console.log('paste', arguments, $('.summernote')[0] === this); | ||
}, | ||
onBeforeCommand: function () { | ||
console.log('onBeforeCommand', arguments, $('.summernote')[0] === this); | ||
}, | ||
onChange: function () { | ||
console.log('onChange', arguments, $('.summernote')[0] === this); | ||
}, | ||
onImageUpload: function () { | ||
console.log('onImageUpload', arguments, $('.summernote')[0] === this); | ||
}, | ||
onImageUploadError: function () { | ||
console.log('onImageUploadError', arguments, $('.summernote')[0] === this); | ||
} | ||
}).on('summernote.init', function () { | ||
console.log('summernote.init', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.focus', function () { | ||
console.log('summernote.focus', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.blur', function () { | ||
console.log('summernote.blur', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.keydown', function () { | ||
console.log('summernote.keydown', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.keyup', function () { | ||
console.log('summernote.keyup', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.enter', function () { | ||
console.log('summernote.enter', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.mousedown', function () { | ||
console.log('summernote.mousedown', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.mouseup', function () { | ||
console.log('summernote.mouseup', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.scroll', function () { | ||
console.log('summernote.scroll', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.paste', function () { | ||
console.log('summernote.paste', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.before.command', function () { | ||
console.log('summernote.before.command', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.change', function () { | ||
console.log('summernote.change', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.image.upload', function () { | ||
console.log('summernote.image.upload', arguments, $('.summernote')[0] === this); | ||
}).on('summernote.image.upload.error', function () { | ||
console.log('summernote.image.error', arguments, $('.summernote')[0] === this); | ||
}); | ||
}); |
@@ -191,28 +191,4 @@ define([ | ||
/** | ||
* Moves the scrollbar to start container(sc) of current range | ||
* | ||
* @return {WrappedRange} | ||
*/ | ||
this.scrollIntoView = function () { | ||
if (this.sc.scrollIntoView) { | ||
this.sc.scrollIntoView(false); | ||
} | ||
return this; | ||
}; | ||
/** | ||
* set a focus into start container of current range | ||
* | ||
* @return {WrappedRange} | ||
*/ | ||
this.focus = function () { | ||
this.sc.focus(); | ||
return this; | ||
}; | ||
/** | ||
* @return {WrappedRange} | ||
*/ | ||
this.normalize = function () { | ||
@@ -219,0 +195,0 @@ |
@@ -79,3 +79,3 @@ define([ | ||
range.create(nextPara, 0).normalize().select().focus().scrollIntoView(); | ||
range.create(nextPara, 0).normalize().select(); | ||
@@ -82,0 +82,0 @@ }; |
@@ -30,3 +30,2 @@ define([ | ||
* - TODO: new instance per a editor | ||
* - TODO: rename EventHandler | ||
*/ | ||
@@ -52,4 +51,9 @@ var EventHandler = function () { | ||
// TODO refactor modules and eventHandler | ||
// - remove this method and use custom event from $holder instead | ||
/** | ||
* invoke module's method | ||
* | ||
* @param {String} moduleAndMethod - ex) 'editor.redo' | ||
* @param {...*} arguments - arguments of method | ||
* @return {*} | ||
*/ | ||
this.invoke = function () { | ||
@@ -90,3 +94,3 @@ var moduleAndMethod = list.head(list.from(arguments)); | ||
if (callback) { | ||
callback(arguments); | ||
callback.apply($holder[0], arguments); | ||
} | ||
@@ -114,3 +118,3 @@ return $holder.trigger('summernote.' + eventNamespace, arguments); | ||
if (callbacks.onImageUpload) { | ||
bindCustomEvent($holder, callbacks, 'image.upload')([files]); | ||
bindCustomEvent($holder, callbacks, 'image.upload')(files); | ||
// else insert Image as dataURL | ||
@@ -462,8 +466,7 @@ } else { | ||
// [workaround] for old IE - IE8 don't have input events | ||
if (agent.isMSIE) { | ||
var sDomEvents = 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted'; | ||
$editable.on(sDomEvents, bindCustomEvent($holder, callbacks, 'change')); | ||
} else { | ||
$editable.on('input', bindCustomEvent($holder, callbacks, 'change')); | ||
} | ||
// - TODO check IE version | ||
var changeEventName = agent.isMSIE ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input'; | ||
$editable.on(changeEventName, function () { | ||
bindCustomEvent($holder, callbacks, 'change')($editable.html(), $editable); | ||
}); | ||
@@ -470,0 +473,0 @@ // callbacks for advanced features (camel) |
@@ -102,3 +102,4 @@ define([ | ||
this.deactivate = function (layoutInfo) { | ||
var $editor = layoutInfo.editor(), | ||
var $holder = layoutInfo.holder(), | ||
$editor = layoutInfo.editor(), | ||
$toolbar = layoutInfo.toolbar(), | ||
@@ -117,6 +118,15 @@ $editable = layoutInfo.editable(), | ||
$editable.html(dom.value($codable, options.prettifyHtml) || dom.emptyPara); | ||
var value = dom.value($codable, options.prettifyHtml) || dom.emptyPara; | ||
var isChange = $editable.html() !== value; | ||
$editable.html(value); | ||
$editable.height(options.height ? $codable.height() : 'auto'); | ||
$editor.removeClass('codeview'); | ||
if (isChange) { | ||
handler.bindCustomEvent( | ||
$holder, $editable.data('callbacks'), 'change' | ||
)($editable.html(), $editable); | ||
} | ||
$editable.focus(); | ||
@@ -123,0 +133,0 @@ |
@@ -115,13 +115,13 @@ define([ | ||
var triggerOnBeforeChange = function ($editable) { | ||
// TODO find holder | ||
var $holder = dom.makeLayoutInfo($editable).holder(); | ||
handler.bindCustomEvent( | ||
$(), $editable.data('callbacks'), 'before.command' | ||
).call($editable.html(), $editable); | ||
$holder, $editable.data('callbacks'), 'before.command' | ||
)($editable.html(), $editable); | ||
}; | ||
var triggerOnChange = function ($editable) { | ||
// TODO find holder | ||
var $holder = dom.makeLayoutInfo($editable).holder(); | ||
handler.bindCustomEvent( | ||
$(), $editable.data('callbacks'), 'change' | ||
).call($editable.html(), $editable); | ||
$holder, $editable.data('callbacks'), 'change' | ||
)($editable.html(), $editable); | ||
}; | ||
@@ -128,0 +128,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1406345
0
123
34431
13
- Removedopen@0.0.4
- Removedopen@0.0.4(transitive)