-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve
BlockToolAdapter
(#68)
* feat: improve `BlockToolAdapter` [skip ci] * fix: allow three type input * feat: update code * fix: example * fix: correctly delete backward * fix: input * fix: improve * fix: improve * fix: abstract * fix: special case for input delete * fix: special case for command delete * fix: insert into the middle * revert: change * Update packages/dom-adapters/src/BlockToolAdapter/index.ts Co-authored-by: Peter Savchenko <[email protected]> * fix: abstract function * fix: add comment * fix: remove mode field * fix: remove one case that might not happen * backspace and delete handling in native inputs * added handler for non-text inputs * lint fix * lint fix in dom adapters * rm unwanted change * add root linter * get rid of anonymous functions * fix native input style * added jsdoc * typo * lint fix --------- Co-authored-by: Peter Savchenko <[email protected]> Co-authored-by: e11sy <[email protected]>
- Loading branch information
1 parent
27adb2e
commit 58671e2
Showing
11 changed files
with
273 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,9 @@ | |
"packageManager": "[email protected]", | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
], | ||
"scripts": { | ||
"lint": "yarn workspaces foreach -A run lint", | ||
"lint:fix": "yarn workspaces foreach -A run lint --fix" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
"typescript": "^5.2.2" | ||
}, | ||
"dependencies": { | ||
"@editorjs/dom": "^1.0.0", | ||
"@editorjs/model": "workspace:^" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './getAbsoluteRangeOffset.js'; | ||
export * from './getRelativeIndex.js'; | ||
export * from './isNonTextInput.js'; |
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,25 @@ | ||
enum TextInputType { | ||
Text = 'text', | ||
Tel = 'tel', | ||
Search = 'search', | ||
Url = 'url', | ||
Password = 'password', | ||
} | ||
|
||
const TEXT_INPUT_SET = new Set([ | ||
TextInputType.Text, | ||
TextInputType.Tel, | ||
TextInputType.Search, | ||
TextInputType.Url, | ||
TextInputType.Password, | ||
]) as ReadonlySet<string>; | ||
|
||
/** | ||
* Checks if a given HTML input element is not a text input. | ||
* | ||
* @param {HTMLElement} element - The HTML element to check. | ||
* @returns {boolean} - Returns true if the element is not a text input, false otherwise. | ||
*/ | ||
export function isNonTextInput(element: HTMLInputElement): boolean { | ||
return !TEXT_INPUT_SET.has(element.type); | ||
} |
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
Oops, something went wrong.