Skip to content

Instantly share code, notes, and snippets.

@kiranparajuli589
Created November 14, 2021 06:22
Show Gist options
  • Select an option

  • Save kiranparajuli589/fde999671452639c4403b9cde018e536 to your computer and use it in GitHub Desktop.

Select an option

Save kiranparajuli589/fde999671452639c4403b9cde018e536 to your computer and use it in GitHub Desktop.
Smile replacer for tiptap editor
import {Extension, textInputRule} from "@tiptap/core"
export const SmilieReplacer = Extension.create({
name: "smilieReplacer",
addInputRules() {
return [
textInputRule({find: /-___- $/, replace: "๐Ÿ˜‘ "}),
textInputRule({find: /:"-\) $/, replace: "๐Ÿ˜‚ "}),
textInputRule({find: /':-\) $/, replace: "๐Ÿ˜… "}),
textInputRule({find: /':-D $/, replace: "๐Ÿ˜… "}),
textInputRule({find: />:-\) $/, replace: "๐Ÿ˜† "}),
textInputRule({find: /-__- $/, replace: "๐Ÿ˜‘ "}),
textInputRule({find: /':-\( $/, replace: "๐Ÿ˜“ "}),
textInputRule({find: /:'-\( $/, replace: "๐Ÿ˜ข "}),
textInputRule({find: />:-\( $/, replace: "๐Ÿ˜  "}),
textInputRule({find: /O:-\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /0:-3 $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /0:-\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /0;\^\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /O;-\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /0;-\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /O:-3 $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /:'\) $/, replace: "๐Ÿ˜‚ "}),
textInputRule({find: /:-D $/, replace: "๐Ÿ˜ƒ "}),
textInputRule({find: /':\) $/, replace: "๐Ÿ˜… "}),
textInputRule({find: /'=\) $/, replace: "๐Ÿ˜… "}),
textInputRule({find: /':D $/, replace: "๐Ÿ˜… "}),
textInputRule({find: /'=D $/, replace: "๐Ÿ˜… "}),
textInputRule({find: />:\) $/, replace: "๐Ÿ˜† "}),
textInputRule({find: />;\) $/, replace: "๐Ÿ˜† "}),
textInputRule({find: />=\) $/, replace: "๐Ÿ˜† "}),
textInputRule({find: /;-\) $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /\*-\) $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /;-\] $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /;\^\) $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /B-\) $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /8-\) $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /B-D $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /8-D $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /:-\* $/, replace: "๐Ÿ˜˜ "}),
textInputRule({find: /:\^\* $/, replace: "๐Ÿ˜˜ "}),
textInputRule({find: /:-\) $/, replace: "๐Ÿ™‚ "}),
textInputRule({find: /-_- $/, replace: "๐Ÿ˜‘ "}),
textInputRule({find: /:-X $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /:-# $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /:-x $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: />.< $/, replace: "๐Ÿ˜ฃ "}),
textInputRule({find: /:-O $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: /:-o $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: /O_O $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: />:O $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: /:-P $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:-p $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:-รž $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:-รพ $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:-b $/, replace: "๐Ÿ˜› "}),
textInputRule({find: />:P $/, replace: "๐Ÿ˜œ "}),
textInputRule({find: /X-P $/, replace: "๐Ÿ˜œ "}),
textInputRule({find: /x-p $/, replace: "๐Ÿ˜œ "}),
textInputRule({find: /":\( $/, replace: "๐Ÿ˜“ "}),
textInputRule({find: /"=\( $/, replace: "๐Ÿ˜“ "}),
textInputRule({find: />:\\ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: />:\/ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /:-\/ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /:-. $/, replace: "๐Ÿ˜• "}),
textInputRule({find: />:\[ $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /:-\( $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /:-\[ $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /:"\( $/, replace: "๐Ÿ˜ข "}),
textInputRule({find: /;-\( $/, replace: "๐Ÿ˜ข "}),
textInputRule({find: /#-\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: /%-\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: /X-\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: />:\( $/, replace: "๐Ÿ˜  "}),
textInputRule({find: /0:3 $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /0:\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /O:\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /O=\) $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /O:3 $/, replace: "๐Ÿ˜‡ "}),
textInputRule({find: /<\/3 $/, replace: "๐Ÿ’” "}),
textInputRule({find: /:D $/, replace: "๐Ÿ˜ƒ "}),
textInputRule({find: /=D $/, replace: "๐Ÿ˜ƒ "}),
textInputRule({find: /;\) $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /\*\) $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /;\] $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /;D $/, replace: "๐Ÿ˜‰ "}),
textInputRule({find: /B\) $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /8\) $/, replace: "๐Ÿ˜Ž "}),
textInputRule({find: /:\* $/, replace: "๐Ÿ˜˜ "}),
textInputRule({find: /=\* $/, replace: "๐Ÿ˜˜ "}),
textInputRule({find: /:\) $/, replace: "๐Ÿ™‚ "}),
textInputRule({find: /=\] $/, replace: "๐Ÿ™‚ "}),
textInputRule({find: /=\) $/, replace: "๐Ÿ™‚ "}),
textInputRule({find: /:\] $/, replace: "๐Ÿ™‚ "}),
textInputRule({find: /:X $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /:# $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /=X $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /=x $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /:x $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /=# $/, replace: "๐Ÿ˜ถ "}),
textInputRule({find: /:O $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: /:o $/, replace: "๐Ÿ˜ฎ "}),
textInputRule({find: /:P $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /=P $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:p $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /=p $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:รž $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:รพ $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:b $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /d: $/, replace: "๐Ÿ˜› "}),
textInputRule({find: /:\/ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /:\\ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /=\/ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /=\\ $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /:L $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /=L $/, replace: "๐Ÿ˜• "}),
textInputRule({find: /:\( $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /:\[ $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /=\( $/, replace: "๐Ÿ˜ž "}),
textInputRule({find: /;\( $/, replace: "๐Ÿ˜ข "}),
textInputRule({find: /D: $/, replace: "๐Ÿ˜จ "}),
textInputRule({find: /:\$ $/, replace: "๐Ÿ˜ณ "}),
textInputRule({find: /=\$ $/, replace: "๐Ÿ˜ณ "}),
textInputRule({find: /#\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: /%\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: /X\) $/, replace: "๐Ÿ˜ต "}),
textInputRule({find: /:@ $/, replace: "๐Ÿ˜  "}),
textInputRule({find: /<3 $/, replace: "โค๏ธ "}),
textInputRule({find: /\/shrug $/, replace: "ยฏ\\_(ใƒ„)_/ยฏ"})
]
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment