Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Sep 24, 2024
1 parent 8b7002d commit b418702
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ts/toolbar/Emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {hasClosestByTag} from "../util/hasClosestByHeadings";
import {getEditorRange, insertHTML, setSelectionFocus} from "../util/selection";
import {MenuItem} from "./MenuItem";
import {toggleSubMenu} from "./setToolbar";
import {hasClosestBlock} from "../util/hasClosest";
import {modifyPre} from "../wysiwyg/inlineTag";

export class Emoji extends MenuItem {
public element: HTMLElement;
Expand Down Expand Up @@ -57,6 +59,9 @@ data-value=":${key}: " data-key=":${key}:" class="vditor-emojis__icon" src="${em
} else {
range.extractContents();
range.insertNode(document.createTextNode(value));
if (!hasClosestBlock(range.startContainer)) {
modifyPre(vditor, range);
}
}
range.collapse(false);
setSelectionFocus(range);
Expand Down

0 comments on commit b418702

Please sign in to comment.