@tiptap/extension-emoji 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -19429,7 +19429,7 @@ function shortcodeToEmoji(shortcode, emojis2) {
19429
19429
  // src/emoji.ts
19430
19430
  var EmojiSuggestionPluginKey = new import_state.PluginKey("emojiSuggestion");
19431
19431
  var inputRegex = /:([a-zA-Z0-9_+-]+):$/;
19432
- var pasteRegex = /:([a-zA-Z0-9_+-]+):/g;
19432
+ var pasteRegex = /(^|\s):([a-zA-Z0-9_+-]+):/g;
19433
19433
  var Emoji = import_core.Node.create({
19434
19434
  name: "emoji",
19435
19435
  inline: true,
@@ -19608,12 +19608,15 @@ var Emoji = import_core.Node.create({
19608
19608
  new import_core.PasteRule({
19609
19609
  find: pasteRegex,
19610
19610
  handler: ({ range, match, chain }) => {
19611
- const name = match[1];
19611
+ const prefix = match[1] || "";
19612
+ const name = match[2];
19612
19613
  if (!shortcodeToEmoji(name, this.options.emojis)) {
19613
19614
  return;
19614
19615
  }
19616
+ const shortcodeFrom = range.from + prefix.length;
19617
+ const shortcodeTo = range.to;
19615
19618
  chain().insertContentAt(
19616
- range,
19619
+ { from: shortcodeFrom, to: shortcodeTo },
19617
19620
  {
19618
19621
  type: this.name,
19619
19622
  attrs: {