-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow holderId work with ref on dom element #710
Merged
talyguryn
merged 17 commits into
codex-team:release/2.13
from
dimensi:feature-holder-on-ref
Apr 15, 2019
Merged
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3f6e095
done
dimensi 594e30c
update types
dimensi 633508e
attempt to simplify code
dimensi 6078202
remove useless helper
8ed1916
revert holderId logic and add holder property
a4b7b4c
Apply suggestions from code review
gohabereg 7eb71d6
update holder type on string | HTMLElement
dimensi 46b8406
fix typo
dimensi c841e53
add deprecated notice and fix typos
dimensi e8f3e05
fix wrong compare
dimensi af1d2ea
fix comments
dimensi 81471c2
swap console.log on _.log
dimensi 97d1ac1
update types for editor config
dimensi 4f238cc
update examples
9f2f798
Merge remote-tracking branch 'master/release/2.13' into feature-holde…
3c9de15
update docs
4363832
update build
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -134,11 +134,7 @@ export default class UI extends Module { | |
* Element where we need to append Editor.js | ||
* @type {Element} | ||
*/ | ||
this.nodes.holder = document.getElementById(this.config.holderId); | ||
|
||
if (!this.nodes.holder) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remove it, because we check on exists in |
||
throw Error('Holder wasn\'t found by ID: #' + this.config.holderId); | ||
} | ||
this.nodes.holder = $.getHolder(this.config.holderId); | ||
|
||
/** | ||
* Create and save main UI elements | ||
|
@@ -329,7 +325,8 @@ export default class UI extends Module { | |
*/ | ||
const target = event.target as HTMLElement; | ||
const clickedOnInlineToolbarButton = target.closest(`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`); | ||
const clickedInsideOfEditor = !!target.closest(`#${this.config.holderId}`) || Selection.isAtEditor; | ||
dimensi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const clickedInsideOfEditor = this.nodes.holder.contains(target) || Selection.isAtEditor; | ||
|
||
if (!clickedInsideOfEditor) { | ||
/** | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not understand why you do this. Than i change return type isElement method, i start get errors
[tsl] ERROR in /home/dimensi/projects/@editorjs/editor.js/src/components/modules/blockManager.ts(459,25) TS2339: Property 'parentNode' does not exist on type 'never'.