@tiptap/extension-typography 3.0.0 → 3.0.2-beta.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/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +264 -219
- package/dist/index.cjs.map +1 -1
- package/dist/{packages/extension-typography/src/typography.d.ts → index.d.cts} +28 -24
- package/dist/index.d.ts +144 -0
- package/dist/index.js +217 -194
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- package/src/typography.ts +153 -131
- package/dist/index.umd.js +0 -227
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -161
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -255
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-typography/src/index.d.ts +0 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/typography.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string,\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string,\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string,\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string,\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string,\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string,\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string,\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string,\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string,\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string,\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string,\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string,\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string,\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string,\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string,\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string,\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string,\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string,\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string,\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string,\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string,\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string,\n}\n\nexport const emDash = (override?: string) => textInputRule({\n find: /--$/,\n replace: override ?? '—',\n})\n\nexport const ellipsis = (override?: string) => textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n})\n\nexport const openDoubleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n})\n\nexport const closeDoubleQuote = (override?: string) => textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n})\n\nexport const openSingleQuote = (override?: string) => textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n})\n\nexport const closeSingleQuote = (override?: string) => textInputRule({\n find: /'$/,\n replace: override ?? '’',\n})\n\nexport const leftArrow = (override?: string) => textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n})\n\nexport const rightArrow = (override?: string) => textInputRule({\n find: /->$/,\n replace: override ?? '→',\n})\n\nexport const copyright = (override?: string) => textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n})\n\nexport const trademark = (override?: string) => textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n})\n\nexport const servicemark = (override?: string) => textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n})\n\nexport const registeredTrademark = (override?: string) => textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n})\n\nexport const oneHalf = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n})\n\nexport const plusMinus = (override?: string) => textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n})\n\nexport const notEqual = (override?: string) => textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n})\n\nexport const laquo = (override?: string) => textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n})\n\nexport const raquo = (override?: string) => textInputRule({\n find: />>$/,\n replace: override ?? '»',\n})\n\nexport const multiplication = (override?: string) => textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n})\n\nexport const superscriptTwo = (override?: string) => textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n})\n\nexport const superscriptThree = (override?: string) => textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n})\n\nexport const oneQuarter = (override?: string) => textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n})\n\nexport const threeQuarters = (override?: string) => textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n})\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n"],"names":[],"mappings":";;AAwIa,MAAA,MAAM,GAAG,CAAC,QAAiB,KAAK,aAAa,CAAC;AACzD,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA,EAAC;AAEW,MAAA,QAAQ,GAAG,CAAC,QAAiB,KAAK,aAAa,CAAC;AAC3D,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA,EAAC;AAEW,MAAA,eAAe,GAAG,CAAC,QAAiB,KAAK,aAAa,CAAC;AAClE,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA,EAAC;AAEW,MAAA,gBAAgB,GAAG,CAAC,QAAiB,KAAK,aAAa,CAAC;AACnE,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA,EAAC;AAEW,MAAA,eAAe,GAAG,CAAC,QAAiB,KAAK,aAAa,CAAC;AAClE,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAR,KAAA,CAAA,GAAA,QAAQ,GAAI,GAAG;AACzB,CAAA,EAAC;AAEW,MAAA,gB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AAC,cAAc,CAAC,CAAC,CAAA;SACxD;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,KAAK,KAAK,EAAE;AAC3C,YAAA,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAA;SAC5D;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,KAAK,KAAK,EAAE;AACrC,YAAA,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;SAChD;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,EAAE;AACxC,YAAA,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;SACtD;AAED,QAAA,OAAO,KAAK,CAAA;KACb;AACF,CAAA;;;;"}
|
|
1
|
+
{"version":3,"sources":["../src/typography.ts","../src/index.ts"],"sourcesContent":["import { Extension, textInputRule } from '@tiptap/core'\n\nexport interface TypographyOptions {\n /**\n * The em dash character.\n * @default '—'\n */\n emDash: false | string\n\n /**\n * The ellipsis character.\n * @default '…'\n */\n ellipsis: false | string\n\n /**\n * The open double quote character.\n * @default '“'\n */\n openDoubleQuote: false | string\n\n /**\n * The close double quote character.\n * @default '”'\n */\n closeDoubleQuote: false | string\n\n /**\n * The open single quote character.\n * @default '‘'\n */\n openSingleQuote: false | string\n\n /**\n * The close single quote character.\n * @default '’'\n */\n closeSingleQuote: false | string\n\n /**\n * The left arrow character.\n * @default '←'\n */\n leftArrow: false | string\n\n /**\n * The right arrow character.\n * @default '→'\n */\n rightArrow: false | string\n\n /**\n * The copyright character.\n * @default '©'\n */\n copyright: false | string\n\n /**\n * The trademark character.\n * @default '™'\n */\n trademark: false | string\n\n /**\n * The servicemark character.\n * @default '℠'\n */\n servicemark: false | string\n\n /**\n * The registered trademark character.\n * @default '®'\n */\n registeredTrademark: false | string\n\n /**\n * The one half character.\n * @default '½'\n */\n oneHalf: false | string\n\n /**\n * The plus minus character.\n * @default '±'\n */\n plusMinus: false | string\n\n /**\n * The not equal character.\n * @default '≠'\n */\n notEqual: false | string\n\n /**\n * The laquo character.\n * @default '«'\n */\n laquo: false | string\n\n /**\n * The raquo character.\n * @default '»'\n */\n raquo: false | string\n\n /**\n * The multiplication character.\n * @default '×'\n */\n multiplication: false | string\n\n /**\n * The superscript two character.\n * @default '²'\n */\n superscriptTwo: false | string\n\n /**\n * The superscript three character.\n * @default '³'\n */\n superscriptThree: false | string\n\n /**\n * The one quarter character.\n * @default '¼'\n */\n oneQuarter: false | string\n\n /**\n * The three quarters character.\n * @default '¾'\n */\n threeQuarters: false | string\n}\n\nexport const emDash = (override?: string) =>\n textInputRule({\n find: /--$/,\n replace: override ?? '—',\n })\n\nexport const ellipsis = (override?: string) =>\n textInputRule({\n find: /\\.\\.\\.$/,\n replace: override ?? '…',\n })\n\nexport const openDoubleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(\")$/,\n replace: override ?? '“',\n })\n\nexport const closeDoubleQuote = (override?: string) =>\n textInputRule({\n find: /\"$/,\n replace: override ?? '”',\n })\n\nexport const openSingleQuote = (override?: string) =>\n textInputRule({\n find: /(?:^|[\\s{[(<'\"\\u2018\\u201C])(')$/,\n replace: override ?? '‘',\n })\n\nexport const closeSingleQuote = (override?: string) =>\n textInputRule({\n find: /'$/,\n replace: override ?? '’',\n })\n\nexport const leftArrow = (override?: string) =>\n textInputRule({\n find: /<-$/,\n replace: override ?? '←',\n })\n\nexport const rightArrow = (override?: string) =>\n textInputRule({\n find: /->$/,\n replace: override ?? '→',\n })\n\nexport const copyright = (override?: string) =>\n textInputRule({\n find: /\\(c\\)$/,\n replace: override ?? '©',\n })\n\nexport const trademark = (override?: string) =>\n textInputRule({\n find: /\\(tm\\)$/,\n replace: override ?? '™',\n })\n\nexport const servicemark = (override?: string) =>\n textInputRule({\n find: /\\(sm\\)$/,\n replace: override ?? '℠',\n })\n\nexport const registeredTrademark = (override?: string) =>\n textInputRule({\n find: /\\(r\\)$/,\n replace: override ?? '®',\n })\n\nexport const oneHalf = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/2)\\s$/,\n replace: override ?? '½',\n })\n\nexport const plusMinus = (override?: string) =>\n textInputRule({\n find: /\\+\\/-$/,\n replace: override ?? '±',\n })\n\nexport const notEqual = (override?: string) =>\n textInputRule({\n find: /!=$/,\n replace: override ?? '≠',\n })\n\nexport const laquo = (override?: string) =>\n textInputRule({\n find: /<<$/,\n replace: override ?? '«',\n })\n\nexport const raquo = (override?: string) =>\n textInputRule({\n find: />>$/,\n replace: override ?? '»',\n })\n\nexport const multiplication = (override?: string) =>\n textInputRule({\n find: /\\d+\\s?([*x])\\s?\\d+$/,\n replace: override ?? '×',\n })\n\nexport const superscriptTwo = (override?: string) =>\n textInputRule({\n find: /\\^2$/,\n replace: override ?? '²',\n })\n\nexport const superscriptThree = (override?: string) =>\n textInputRule({\n find: /\\^3$/,\n replace: override ?? '³',\n })\n\nexport const oneQuarter = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(1\\/4)\\s$/,\n replace: override ?? '¼',\n })\n\nexport const threeQuarters = (override?: string) =>\n textInputRule({\n find: /(?:^|\\s)(3\\/4)\\s$/,\n replace: override ?? '¾',\n })\n\n/**\n * This extension allows you to add typography replacements for specific characters.\n * @see https://www.tiptap.dev/api/extensions/typography\n */\nexport const Typography = Extension.create<TypographyOptions>({\n name: 'typography',\n\n addOptions() {\n return {\n closeDoubleQuote: '”',\n closeSingleQuote: '’',\n copyright: '©',\n ellipsis: '…',\n emDash: '—',\n laquo: '«',\n leftArrow: '←',\n multiplication: '×',\n notEqual: '≠',\n oneHalf: '½',\n oneQuarter: '¼',\n openDoubleQuote: '“',\n openSingleQuote: '‘',\n plusMinus: '±',\n raquo: '»',\n registeredTrademark: '®',\n rightArrow: '→',\n servicemark: '℠',\n superscriptThree: '³',\n superscriptTwo: '²',\n threeQuarters: '¾',\n trademark: '™',\n }\n },\n\n addInputRules() {\n const rules = []\n\n if (this.options.emDash !== false) {\n rules.push(emDash(this.options.emDash))\n }\n\n if (this.options.ellipsis !== false) {\n rules.push(ellipsis(this.options.ellipsis))\n }\n\n if (this.options.openDoubleQuote !== false) {\n rules.push(openDoubleQuote(this.options.openDoubleQuote))\n }\n\n if (this.options.closeDoubleQuote !== false) {\n rules.push(closeDoubleQuote(this.options.closeDoubleQuote))\n }\n\n if (this.options.openSingleQuote !== false) {\n rules.push(openSingleQuote(this.options.openSingleQuote))\n }\n\n if (this.options.closeSingleQuote !== false) {\n rules.push(closeSingleQuote(this.options.closeSingleQuote))\n }\n\n if (this.options.leftArrow !== false) {\n rules.push(leftArrow(this.options.leftArrow))\n }\n\n if (this.options.rightArrow !== false) {\n rules.push(rightArrow(this.options.rightArrow))\n }\n\n if (this.options.copyright !== false) {\n rules.push(copyright(this.options.copyright))\n }\n\n if (this.options.trademark !== false) {\n rules.push(trademark(this.options.trademark))\n }\n\n if (this.options.servicemark !== false) {\n rules.push(servicemark(this.options.servicemark))\n }\n\n if (this.options.registeredTrademark !== false) {\n rules.push(registeredTrademark(this.options.registeredTrademark))\n }\n\n if (this.options.oneHalf !== false) {\n rules.push(oneHalf(this.options.oneHalf))\n }\n\n if (this.options.plusMinus !== false) {\n rules.push(plusMinus(this.options.plusMinus))\n }\n\n if (this.options.notEqual !== false) {\n rules.push(notEqual(this.options.notEqual))\n }\n\n if (this.options.laquo !== false) {\n rules.push(laquo(this.options.laquo))\n }\n\n if (this.options.raquo !== false) {\n rules.push(raquo(this.options.raquo))\n }\n\n if (this.options.multiplication !== false) {\n rules.push(multiplication(this.options.multiplication))\n }\n\n if (this.options.superscriptTwo !== false) {\n rules.push(superscriptTwo(this.options.superscriptTwo))\n }\n\n if (this.options.superscriptThree !== false) {\n rules.push(superscriptThree(this.options.superscriptThree))\n }\n\n if (this.options.oneQuarter !== false) {\n rules.push(oneQuarter(this.options.oneQuarter))\n }\n\n if (this.options.threeQuarters !== false) {\n rules.push(threeQuarters(this.options.threeQuarters))\n }\n\n return rules\n },\n})\n","import { Typography } from './typography.js'\n\nexport * from './typography.js'\n\nexport default Typography\n"],"mappings":";AAAA,SAAS,WAAW,qBAAqB;AAwIlC,IAAM,SAAS,CAAC,aACrB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,WAAW,CAAC,aACvB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,aAC9B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,aAC/B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,kBAAkB,CAAC,aAC9B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,mBAAmB,CAAC,aAC/B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,YAAY,CAAC,aACxB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,aAAa,CAAC,aACzB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,YAAY,CAAC,aACxB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,YAAY,CAAC,aACxB,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,cAAc,CAAC,aAC1B,cAAc;AAAA,EACZ,MAAM;AAAA,EACN,SAAS,8BAAY;AACvB,CAAC;AAEI,IAAM,sBAAsB,C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AK,QAAQ,kBAAkB,OAAO;AACxC,YAAM,KAAK,cAAc,KAAK,QAAQ,aAAa,CAAC;AAAA,IACtD;AAEA,WAAO;AAAA,EACT;AACF,CAAC;;;ACvYD,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-typography",
|
|
3
3
|
"description": "typography extension for tiptap",
|
|
4
|
-
"version": "3.0.0",
|
|
4
|
+
"version": "3.0.2-beta.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,24 +15,26 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types":
|
|
18
|
+
"types": {
|
|
19
|
+
"import": "./dist/index.d.ts",
|
|
20
|
+
"require": "./dist/index.d.cts"
|
|
21
|
+
},
|
|
19
22
|
"import": "./dist/index.js",
|
|
20
23
|
"require": "./dist/index.cjs"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"main": "dist/index.cjs",
|
|
24
27
|
"module": "dist/index.js",
|
|
25
|
-
"
|
|
26
|
-
"types": "dist/packages/extension-typography/src/index.d.ts",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
27
29
|
"files": [
|
|
28
30
|
"src",
|
|
29
31
|
"dist"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@tiptap/core": "^3.0.0"
|
|
34
|
+
"@tiptap/core": "^3.0.2-beta.0"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
|
-
"@tiptap/core": "^3.0.0"
|
|
37
|
+
"@tiptap/core": "^3.0.2-beta.0"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"directory": "packages/extension-typography"
|
|
41
43
|
},
|
|
42
44
|
"scripts": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
45
47
|
}
|
|
46
|
-
}
|
|
48
|
+
}
|
package/src/typography.ts
CHANGED
|
@@ -5,244 +5,266 @@ export interface TypographyOptions {
|
|
|
5
5
|
* The em dash character.
|
|
6
6
|
* @default '—'
|
|
7
7
|
*/
|
|
8
|
-
emDash: false | string
|
|
8
|
+
emDash: false | string
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The ellipsis character.
|
|
12
12
|
* @default '…'
|
|
13
13
|
*/
|
|
14
|
-
ellipsis: false | string
|
|
14
|
+
ellipsis: false | string
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The open double quote character.
|
|
18
18
|
* @default '“'
|
|
19
19
|
*/
|
|
20
|
-
openDoubleQuote: false | string
|
|
20
|
+
openDoubleQuote: false | string
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* The close double quote character.
|
|
24
24
|
* @default '”'
|
|
25
25
|
*/
|
|
26
|
-
closeDoubleQuote: false | string
|
|
26
|
+
closeDoubleQuote: false | string
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* The open single quote character.
|
|
30
30
|
* @default '‘'
|
|
31
31
|
*/
|
|
32
|
-
openSingleQuote: false | string
|
|
32
|
+
openSingleQuote: false | string
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* The close single quote character.
|
|
36
36
|
* @default '’'
|
|
37
37
|
*/
|
|
38
|
-
closeSingleQuote: false | string
|
|
38
|
+
closeSingleQuote: false | string
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The left arrow character.
|
|
42
42
|
* @default '←'
|
|
43
43
|
*/
|
|
44
|
-
leftArrow: false | string
|
|
44
|
+
leftArrow: false | string
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The right arrow character.
|
|
48
48
|
* @default '→'
|
|
49
49
|
*/
|
|
50
|
-
rightArrow: false | string
|
|
50
|
+
rightArrow: false | string
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* The copyright character.
|
|
54
54
|
* @default '©'
|
|
55
55
|
*/
|
|
56
|
-
copyright: false | string
|
|
56
|
+
copyright: false | string
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* The trademark character.
|
|
60
60
|
* @default '™'
|
|
61
61
|
*/
|
|
62
|
-
trademark: false | string
|
|
62
|
+
trademark: false | string
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* The servicemark character.
|
|
66
66
|
* @default '℠'
|
|
67
67
|
*/
|
|
68
|
-
servicemark: false | string
|
|
68
|
+
servicemark: false | string
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* The registered trademark character.
|
|
72
72
|
* @default '®'
|
|
73
73
|
*/
|
|
74
|
-
registeredTrademark: false | string
|
|
74
|
+
registeredTrademark: false | string
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* The one half character.
|
|
78
78
|
* @default '½'
|
|
79
79
|
*/
|
|
80
|
-
oneHalf: false | string
|
|
80
|
+
oneHalf: false | string
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* The plus minus character.
|
|
84
84
|
* @default '±'
|
|
85
85
|
*/
|
|
86
|
-
plusMinus: false | string
|
|
86
|
+
plusMinus: false | string
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* The not equal character.
|
|
90
90
|
* @default '≠'
|
|
91
91
|
*/
|
|
92
|
-
notEqual: false | string
|
|
92
|
+
notEqual: false | string
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* The laquo character.
|
|
96
96
|
* @default '«'
|
|
97
97
|
*/
|
|
98
|
-
laquo: false | string
|
|
98
|
+
laquo: false | string
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* The raquo character.
|
|
102
102
|
* @default '»'
|
|
103
103
|
*/
|
|
104
|
-
raquo: false | string
|
|
104
|
+
raquo: false | string
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* The multiplication character.
|
|
108
108
|
* @default '×'
|
|
109
109
|
*/
|
|
110
|
-
multiplication: false | string
|
|
110
|
+
multiplication: false | string
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* The superscript two character.
|
|
114
114
|
* @default '²'
|
|
115
115
|
*/
|
|
116
|
-
superscriptTwo: false | string
|
|
116
|
+
superscriptTwo: false | string
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* The superscript three character.
|
|
120
120
|
* @default '³'
|
|
121
121
|
*/
|
|
122
|
-
superscriptThree: false | string
|
|
122
|
+
superscriptThree: false | string
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* The one quarter character.
|
|
126
126
|
* @default '¼'
|
|
127
127
|
*/
|
|
128
|
-
oneQuarter: false | string
|
|
128
|
+
oneQuarter: false | string
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* The three quarters character.
|
|
132
132
|
* @default '¾'
|
|
133
133
|
*/
|
|
134
|
-
threeQuarters: false | string
|
|
134
|
+
threeQuarters: false | string
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
export const emDash = (override?: string) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
export const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
export const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
export const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
137
|
+
export const emDash = (override?: string) =>
|
|
138
|
+
textInputRule({
|
|
139
|
+
find: /--$/,
|
|
140
|
+
replace: override ?? '—',
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
export const ellipsis = (override?: string) =>
|
|
144
|
+
textInputRule({
|
|
145
|
+
find: /\.\.\.$/,
|
|
146
|
+
replace: override ?? '…',
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export const openDoubleQuote = (override?: string) =>
|
|
150
|
+
textInputRule({
|
|
151
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
|
|
152
|
+
replace: override ?? '“',
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
export const closeDoubleQuote = (override?: string) =>
|
|
156
|
+
textInputRule({
|
|
157
|
+
find: /"$/,
|
|
158
|
+
replace: override ?? '”',
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const openSingleQuote = (override?: string) =>
|
|
162
|
+
textInputRule({
|
|
163
|
+
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
|
|
164
|
+
replace: override ?? '‘',
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
export const closeSingleQuote = (override?: string) =>
|
|
168
|
+
textInputRule({
|
|
169
|
+
find: /'$/,
|
|
170
|
+
replace: override ?? '’',
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
export const leftArrow = (override?: string) =>
|
|
174
|
+
textInputRule({
|
|
175
|
+
find: /<-$/,
|
|
176
|
+
replace: override ?? '←',
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
export const rightArrow = (override?: string) =>
|
|
180
|
+
textInputRule({
|
|
181
|
+
find: /->$/,
|
|
182
|
+
replace: override ?? '→',
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
export const copyright = (override?: string) =>
|
|
186
|
+
textInputRule({
|
|
187
|
+
find: /\(c\)$/,
|
|
188
|
+
replace: override ?? '©',
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
export const trademark = (override?: string) =>
|
|
192
|
+
textInputRule({
|
|
193
|
+
find: /\(tm\)$/,
|
|
194
|
+
replace: override ?? '™',
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
export const servicemark = (override?: string) =>
|
|
198
|
+
textInputRule({
|
|
199
|
+
find: /\(sm\)$/,
|
|
200
|
+
replace: override ?? '℠',
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
export const registeredTrademark = (override?: string) =>
|
|
204
|
+
textInputRule({
|
|
205
|
+
find: /\(r\)$/,
|
|
206
|
+
replace: override ?? '®',
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
export const oneHalf = (override?: string) =>
|
|
210
|
+
textInputRule({
|
|
211
|
+
find: /(?:^|\s)(1\/2)\s$/,
|
|
212
|
+
replace: override ?? '½',
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
export const plusMinus = (override?: string) =>
|
|
216
|
+
textInputRule({
|
|
217
|
+
find: /\+\/-$/,
|
|
218
|
+
replace: override ?? '±',
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
export const notEqual = (override?: string) =>
|
|
222
|
+
textInputRule({
|
|
223
|
+
find: /!=$/,
|
|
224
|
+
replace: override ?? '≠',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
export const laquo = (override?: string) =>
|
|
228
|
+
textInputRule({
|
|
229
|
+
find: /<<$/,
|
|
230
|
+
replace: override ?? '«',
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
export const raquo = (override?: string) =>
|
|
234
|
+
textInputRule({
|
|
235
|
+
find: />>$/,
|
|
236
|
+
replace: override ?? '»',
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
export const multiplication = (override?: string) =>
|
|
240
|
+
textInputRule({
|
|
241
|
+
find: /\d+\s?([*x])\s?\d+$/,
|
|
242
|
+
replace: override ?? '×',
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
export const superscriptTwo = (override?: string) =>
|
|
246
|
+
textInputRule({
|
|
247
|
+
find: /\^2$/,
|
|
248
|
+
replace: override ?? '²',
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
export const superscriptThree = (override?: string) =>
|
|
252
|
+
textInputRule({
|
|
253
|
+
find: /\^3$/,
|
|
254
|
+
replace: override ?? '³',
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
export const oneQuarter = (override?: string) =>
|
|
258
|
+
textInputRule({
|
|
259
|
+
find: /(?:^|\s)(1\/4)\s$/,
|
|
260
|
+
replace: override ?? '¼',
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
export const threeQuarters = (override?: string) =>
|
|
264
|
+
textInputRule({
|
|
265
|
+
find: /(?:^|\s)(3\/4)\s$/,
|
|
266
|
+
replace: override ?? '¾',
|
|
267
|
+
})
|
|
246
268
|
|
|
247
269
|
/**
|
|
248
270
|
* This extension allows you to add typography replacements for specific characters.
|