mobiledoc-kit
Advanced tools
Comparing version 0.9.6 to 0.9.7
@@ -107,3 +107,3 @@ 'use strict'; | ||
/** | ||
* The Editor is a core component of mobiledoc-kit. After instantiating | ||
* The Editor is a core component of mobiledoc-kit. After instantiating | ||
* an editor, use {@link Editor#render} to display the editor on the web page. | ||
@@ -478,11 +478,13 @@ * | ||
value: function _notifyRangeChange() { | ||
this._resetRange(); | ||
this._editState.reset(); | ||
if (this.isEditable) { | ||
this._resetRange(); | ||
this._editState.reset(); | ||
if (this._editState.rangeDidChange()) { | ||
this._rangeDidChange(); | ||
if (this._editState.rangeDidChange()) { | ||
this._rangeDidChange(); | ||
} | ||
if (this._editState.inputModeDidChange()) { | ||
this._inputModeDidChange(); | ||
} | ||
} | ||
if (this._editState.inputModeDidChange()) { | ||
this._inputModeDidChange(); | ||
} | ||
} | ||
@@ -489,0 +491,0 @@ }, { |
"use strict"; | ||
exports["default"] = { | ||
isMac: /Mac/.test(navigator.platform) | ||
isMac: window.navigator && /Mac/.test(window.navigator.platform) | ||
}; |
@@ -67,3 +67,4 @@ 'use strict'; | ||
function isKeyEvent(event) { | ||
return !!event.charCode || !!event.keyCode || !!event.metaKey || !!event.shiftKey || !!event.ctrlKey; | ||
return (/^key/.test(event.type) | ||
); | ||
} | ||
@@ -70,0 +71,0 @@ |
@@ -130,5 +130,17 @@ 'use strict'; | ||
if (position & Node.DOCUMENT_POSITION_CONTAINS) { | ||
if (focusOffset < focusNode.childNodes.length) { | ||
focusNode = focusNode.childNodes[focusOffset]; | ||
focusOffset = 0; | ||
} else { | ||
// This situation happens on IE when triple-clicking to select. | ||
// Set the focus to the very last character inside the node. | ||
while (focusNode.lastChild) { | ||
focusNode = focusNode.lastChild; | ||
} | ||
focusOffset = focusNode.textContent.length; | ||
} | ||
_x3 = { | ||
focusNode: focusNode.childNodes[focusOffset], | ||
focusOffset: 0, | ||
focusNode: focusNode, | ||
focusOffset: focusOffset, | ||
anchorNode: anchorNode, anchorOffset: anchorOffset | ||
@@ -135,0 +147,0 @@ }; |
'use strict'; | ||
exports['default'] = '0.9.6'; | ||
exports['default'] = '0.9.7'; |
{ | ||
"name": "mobiledoc-kit", | ||
"version": "0.9.6", | ||
"version": "0.9.7", | ||
"description": "A toolkit for building WYSIWYG editors with Mobiledoc", | ||
@@ -56,3 +56,3 @@ "repository": "https://github.com/bustlelabs/mobiledoc-kit", | ||
"saucie": "^1.4.0", | ||
"testem": "^1.6.0", | ||
"testem": "^1.7.4", | ||
"tiny-lr": "^0.2.1" | ||
@@ -59,0 +59,0 @@ }, |
@@ -133,2 +133,3 @@ ## Mobiledoc Kit | ||
movement or clicking in the document. | ||
* `editor.onTextInput()` - When the user adds text to the document (see [example](https://github.com/bustlelabs/mobiledoc-kit#responding-to-text-input)) | ||
@@ -135,0 +136,0 @@ ### Programmatic Post Editing |
@@ -69,3 +69,3 @@ import Tooltip from '../views/tooltip'; | ||
/** | ||
* The Editor is a core component of mobiledoc-kit. After instantiating | ||
* The Editor is a core component of mobiledoc-kit. After instantiating | ||
* an editor, use {@link Editor#render} to display the editor on the web page. | ||
@@ -413,11 +413,13 @@ * | ||
_notifyRangeChange() { | ||
this._resetRange(); | ||
this._editState.reset(); | ||
if (this.isEditable) { | ||
this._resetRange(); | ||
this._editState.reset(); | ||
if (this._editState.rangeDidChange()) { | ||
this._rangeDidChange(); | ||
if (this._editState.rangeDidChange()) { | ||
this._rangeDidChange(); | ||
} | ||
if (this._editState.inputModeDidChange()) { | ||
this._inputModeDidChange(); | ||
} | ||
} | ||
if (this._editState.inputModeDidChange()) { | ||
this._inputModeDidChange(); | ||
} | ||
} | ||
@@ -424,0 +426,0 @@ |
export default { | ||
isMac: /Mac/.test(navigator.platform) | ||
isMac: window.navigator && /Mac/.test(window.navigator.platform) | ||
}; |
@@ -54,7 +54,3 @@ import Keycodes from './keycodes'; | ||
function isKeyEvent(event) { | ||
return !!event.charCode || | ||
!!event.keyCode || | ||
!!event.metaKey || | ||
!!event.shiftKey || | ||
!!event.ctrlKey; | ||
return /^key/.test(event.type); | ||
} | ||
@@ -61,0 +57,0 @@ |
@@ -102,5 +102,17 @@ import { DIRECTION } from '../utils/key'; | ||
if (position & Node.DOCUMENT_POSITION_CONTAINS) { | ||
if (focusOffset < focusNode.childNodes.length) { | ||
focusNode = focusNode.childNodes[focusOffset]; | ||
focusOffset = 0; | ||
} else { | ||
// This situation happens on IE when triple-clicking to select. | ||
// Set the focus to the very last character inside the node. | ||
while (focusNode.lastChild) { | ||
focusNode = focusNode.lastChild; | ||
} | ||
focusOffset = focusNode.textContent.length; | ||
} | ||
return comparePosition({ | ||
focusNode: focusNode.childNodes[focusOffset], | ||
focusOffset: 0, | ||
focusNode, | ||
focusOffset, | ||
anchorNode, anchorOffset | ||
@@ -107,0 +119,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2966900
42580
342