@tiptap/extension-emoji 3.23.6 → 3.24.0

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/src/emoji.ts CHANGED
@@ -195,7 +195,9 @@ export const Emoji = Node.create<EmojiOptions, EmojiStorage>({
195
195
 
196
196
  renderHTML({ HTMLAttributes, node }) {
197
197
  const emojiItem = shortcodeToEmoji(node.attrs.name, this.options.emojis)
198
- const attributes = mergeAttributes(HTMLAttributes, this.options.HTMLAttributes, { 'data-type': this.name })
198
+ const attributes = mergeAttributes(HTMLAttributes, this.options.HTMLAttributes, {
199
+ 'data-type': this.name,
200
+ })
199
201
 
200
202
  if (!emojiItem) {
201
203
  return ['span', attributes, `:${node.attrs.name}:`]
@@ -303,9 +305,13 @@ export const Emoji = Node.create<EmojiOptions, EmojiStorage>({
303
305
 
304
306
  if (this.options.enableEmoticons) {
305
307
  // get the list of supported emoticons
306
- const emoticons = this.options.emojis.flatMap(item => item.emoticons).filter(item => item) as string[]
308
+ const emoticons = this.options.emojis
309
+ .flatMap(item => item.emoticons)
310
+ .filter(item => item) as string[]
307
311
 
308
- const emoticonRegex = new RegExp(`(?:^|\\s)(${emoticons.map(item => escapeForRegEx(item)).join('|')}) $`)
312
+ const emoticonRegex = new RegExp(
313
+ `(?:^|\\s)(${emoticons.map(item => escapeForRegEx(item)).join('|')}) $`,
314
+ )
309
315
 
310
316
  inputRules.push(
311
317
  nodeInputRule({
@@ -404,7 +410,9 @@ export const Emoji = Node.create<EmojiOptions, EmojiStorage>({
404
410
  if (this.editor.view.composing) {
405
411
  return
406
412
  }
407
- const docChanges = transactions.some(transaction => transaction.docChanged) && !oldState.doc.eq(newState.doc)
413
+ const docChanges =
414
+ transactions.some(transaction => transaction.docChanged) &&
415
+ !oldState.doc.eq(newState.doc)
408
416
 
409
417
  if (!docChanges) {
410
418
  return
package/src/generate.ts CHANGED
@@ -21,8 +21,11 @@ const emojis: EmojiItem[] = data
21
21
  return item.unified === emoji.hexcode || item.non_qualified === emoji.hexcode
22
22
  })
23
23
  const hasFallbackImage = dataSourceEmoji?.has_img_apple
24
- const name = [gitHubShortcodes[emoji.hexcode]].flat()[0] || [emojibaseShortcodes[emoji.hexcode]].flat()[0]
25
- const shortcodes = emojibaseShortcodes[emoji.hexcode] ? [emojibaseShortcodes[emoji.hexcode]].flat() : []
24
+ const name =
25
+ [gitHubShortcodes[emoji.hexcode]].flat()[0] || [emojibaseShortcodes[emoji.hexcode]].flat()[0]
26
+ const shortcodes = emojibaseShortcodes[emoji.hexcode]
27
+ ? [emojibaseShortcodes[emoji.hexcode]].flat()
28
+ : []
26
29
  const emoticons = emoji.emoticon ? [emoji.emoticon].flat() : []
27
30
 
28
31
  return {