[WEB-2424] fix: add optional chaining for parent node (#5571)
* fix: add optional chaining for parent node * chore: revert yarn lock changes
This commit is contained in:
parent
069f8b950e
commit
cc07992e47
3 changed files with 4 additions and 4 deletions
|
|
@ -18,9 +18,9 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
|
|||
let a = event.target as HTMLElement;
|
||||
const els = [];
|
||||
|
||||
while (a.nodeName !== "DIV") {
|
||||
while (a?.nodeName !== "DIV") {
|
||||
els.push(a);
|
||||
a = a.parentNode as HTMLElement;
|
||||
a = a?.parentNode as HTMLElement;
|
||||
}
|
||||
|
||||
if (!els.find((value) => value.nodeName === "A")) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const Command = Extension.create<SlashCommandOptions>({
|
|||
const { selection } = editor.state;
|
||||
|
||||
const parentNode = selection.$from.node(selection.$from.depth);
|
||||
const blockType = parentNode.type.name;
|
||||
const blockType = parentNode?.type?.name;
|
||||
|
||||
if (blockType === "codeBlock") {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -13146,4 +13146,4 @@ zeed-dom@^0.10.9:
|
|||
zxcvbn@^4.4.2:
|
||||
version "4.4.2"
|
||||
resolved "https://registry.yarnpkg.com/zxcvbn/-/zxcvbn-4.4.2.tgz#28ec17cf09743edcab056ddd8b1b06262cc73c30"
|
||||
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
|
||||
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
|
||||
Loading…
Add table
Add a link
Reference in a new issue