-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check if the item has property in cursorDidChange -> arrayToMap
It is possible for the content-kit-editor to report that a card is the active section. Cards do not have a `tagName` property, and as a result an error will be thrown when trying to camelize `undefined`.
- Loading branch information
Showing
4 changed files
with
116 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default function moveCursorTo(context, selector) { | ||
let element = context.$(selector); | ||
if (!element.length) { | ||
throw new Error(`could not find element from selector ${selector}`); | ||
} else if (element.length > 1) { | ||
throw new Error(`ambiguous selector ${selector}`); | ||
} | ||
|
||
window.getSelection().removeAllRanges(); | ||
|
||
let node = element[0].firstChild; | ||
let range = document.createRange(); | ||
range.selectNode(node); | ||
window.getSelection().addRange(range); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function simulateMouseup() { | ||
let event = document.createEvent('MouseEvents'); | ||
event.initMouseEvent('mouseup'); | ||
document.dispatchEvent(event); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters