@tiptap/extension-typography
Advanced tools
Comparing version 2.0.0-beta.213 to 2.0.0-beta.214
@@ -1,192 +0,166 @@ | ||
// src/typography.ts | ||
import { Extension, textInputRule } from "@tiptap/core"; | ||
var emDash = textInputRule({ | ||
find: /--$/, | ||
replace: "\u2014" | ||
import { textInputRule, Extension } from '@tiptap/core'; | ||
const emDash = textInputRule({ | ||
find: /--$/, | ||
replace: '—', | ||
}); | ||
var ellipsis = textInputRule({ | ||
find: /\.\.\.$/, | ||
replace: "\u2026" | ||
const ellipsis = textInputRule({ | ||
find: /\.\.\.$/, | ||
replace: '…', | ||
}); | ||
var openDoubleQuote = textInputRule({ | ||
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/, | ||
replace: "\u201C" | ||
const openDoubleQuote = textInputRule({ | ||
find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/, | ||
replace: '“', | ||
}); | ||
var closeDoubleQuote = textInputRule({ | ||
find: /"$/, | ||
replace: "\u201D" | ||
const closeDoubleQuote = textInputRule({ | ||
find: /"$/, | ||
replace: '”', | ||
}); | ||
var openSingleQuote = textInputRule({ | ||
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/, | ||
replace: "\u2018" | ||
const openSingleQuote = textInputRule({ | ||
find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/, | ||
replace: '‘', | ||
}); | ||
var closeSingleQuote = textInputRule({ | ||
find: /'$/, | ||
replace: "\u2019" | ||
const closeSingleQuote = textInputRule({ | ||
find: /'$/, | ||
replace: '’', | ||
}); | ||
var leftArrow = textInputRule({ | ||
find: /<-$/, | ||
replace: "\u2190" | ||
const leftArrow = textInputRule({ | ||
find: /<-$/, | ||
replace: '←', | ||
}); | ||
var rightArrow = textInputRule({ | ||
find: /->$/, | ||
replace: "\u2192" | ||
const rightArrow = textInputRule({ | ||
find: /->$/, | ||
replace: '→', | ||
}); | ||
var copyright = textInputRule({ | ||
find: /\(c\)$/, | ||
replace: "\xA9" | ||
const copyright = textInputRule({ | ||
find: /\(c\)$/, | ||
replace: '©', | ||
}); | ||
var trademark = textInputRule({ | ||
find: /\(tm\)$/, | ||
replace: "\u2122" | ||
const trademark = textInputRule({ | ||
find: /\(tm\)$/, | ||
replace: '™', | ||
}); | ||
var servicemark = textInputRule({ | ||
find: /\(sm\)$/, | ||
replace: "\u2120" | ||
const servicemark = textInputRule({ | ||
find: /\(sm\)$/, | ||
replace: '℠', | ||
}); | ||
var registeredTrademark = textInputRule({ | ||
find: /\(r\)$/, | ||
replace: "\xAE" | ||
const registeredTrademark = textInputRule({ | ||
find: /\(r\)$/, | ||
replace: '®', | ||
}); | ||
var oneHalf = textInputRule({ | ||
find: /1\/2$/, | ||
replace: "\xBD" | ||
const oneHalf = textInputRule({ | ||
find: /1\/2$/, | ||
replace: '½', | ||
}); | ||
var plusMinus = textInputRule({ | ||
find: /\+\/-$/, | ||
replace: "\xB1" | ||
const plusMinus = textInputRule({ | ||
find: /\+\/-$/, | ||
replace: '±', | ||
}); | ||
var notEqual = textInputRule({ | ||
find: /!=$/, | ||
replace: "\u2260" | ||
const notEqual = textInputRule({ | ||
find: /!=$/, | ||
replace: '≠', | ||
}); | ||
var laquo = textInputRule({ | ||
find: /<<$/, | ||
replace: "\xAB" | ||
const laquo = textInputRule({ | ||
find: /<<$/, | ||
replace: '«', | ||
}); | ||
var raquo = textInputRule({ | ||
find: />>$/, | ||
replace: "\xBB" | ||
const raquo = textInputRule({ | ||
find: />>$/, | ||
replace: '»', | ||
}); | ||
var multiplication = textInputRule({ | ||
find: /\d+\s?([*x])\s?\d+$/, | ||
replace: "\xD7" | ||
const multiplication = textInputRule({ | ||
find: /\d+\s?([*x])\s?\d+$/, | ||
replace: '×', | ||
}); | ||
var superscriptTwo = textInputRule({ | ||
find: /\^2$/, | ||
replace: "\xB2" | ||
const superscriptTwo = textInputRule({ | ||
find: /\^2$/, | ||
replace: '²', | ||
}); | ||
var superscriptThree = textInputRule({ | ||
find: /\^3$/, | ||
replace: "\xB3" | ||
const superscriptThree = textInputRule({ | ||
find: /\^3$/, | ||
replace: '³', | ||
}); | ||
var oneQuarter = textInputRule({ | ||
find: /1\/4$/, | ||
replace: "\xBC" | ||
const oneQuarter = textInputRule({ | ||
find: /1\/4$/, | ||
replace: '¼', | ||
}); | ||
var threeQuarters = textInputRule({ | ||
find: /3\/4$/, | ||
replace: "\xBE" | ||
const threeQuarters = textInputRule({ | ||
find: /3\/4$/, | ||
replace: '¾', | ||
}); | ||
var Typography = Extension.create({ | ||
name: "typography", | ||
addInputRules() { | ||
const rules = []; | ||
if (this.options.emDash !== false) { | ||
rules.push(emDash); | ||
} | ||
if (this.options.ellipsis !== false) { | ||
rules.push(ellipsis); | ||
} | ||
if (this.options.openDoubleQuote !== false) { | ||
rules.push(openDoubleQuote); | ||
} | ||
if (this.options.closeDoubleQuote !== false) { | ||
rules.push(closeDoubleQuote); | ||
} | ||
if (this.options.openSingleQuote !== false) { | ||
rules.push(openSingleQuote); | ||
} | ||
if (this.options.closeSingleQuote !== false) { | ||
rules.push(closeSingleQuote); | ||
} | ||
if (this.options.leftArrow !== false) { | ||
rules.push(leftArrow); | ||
} | ||
if (this.options.rightArrow !== false) { | ||
rules.push(rightArrow); | ||
} | ||
if (this.options.copyright !== false) { | ||
rules.push(copyright); | ||
} | ||
if (this.options.trademark !== false) { | ||
rules.push(trademark); | ||
} | ||
if (this.options.servicemark !== false) { | ||
rules.push(servicemark); | ||
} | ||
if (this.options.registeredTrademark !== false) { | ||
rules.push(registeredTrademark); | ||
} | ||
if (this.options.oneHalf !== false) { | ||
rules.push(oneHalf); | ||
} | ||
if (this.options.plusMinus !== false) { | ||
rules.push(plusMinus); | ||
} | ||
if (this.options.notEqual !== false) { | ||
rules.push(notEqual); | ||
} | ||
if (this.options.laquo !== false) { | ||
rules.push(laquo); | ||
} | ||
if (this.options.raquo !== false) { | ||
rules.push(raquo); | ||
} | ||
if (this.options.multiplication !== false) { | ||
rules.push(multiplication); | ||
} | ||
if (this.options.superscriptTwo !== false) { | ||
rules.push(superscriptTwo); | ||
} | ||
if (this.options.superscriptThree !== false) { | ||
rules.push(superscriptThree); | ||
} | ||
if (this.options.oneQuarter !== false) { | ||
rules.push(oneQuarter); | ||
} | ||
if (this.options.threeQuarters !== false) { | ||
rules.push(threeQuarters); | ||
} | ||
return rules; | ||
} | ||
const Typography = Extension.create({ | ||
name: 'typography', | ||
addInputRules() { | ||
const rules = []; | ||
if (this.options.emDash !== false) { | ||
rules.push(emDash); | ||
} | ||
if (this.options.ellipsis !== false) { | ||
rules.push(ellipsis); | ||
} | ||
if (this.options.openDoubleQuote !== false) { | ||
rules.push(openDoubleQuote); | ||
} | ||
if (this.options.closeDoubleQuote !== false) { | ||
rules.push(closeDoubleQuote); | ||
} | ||
if (this.options.openSingleQuote !== false) { | ||
rules.push(openSingleQuote); | ||
} | ||
if (this.options.closeSingleQuote !== false) { | ||
rules.push(closeSingleQuote); | ||
} | ||
if (this.options.leftArrow !== false) { | ||
rules.push(leftArrow); | ||
} | ||
if (this.options.rightArrow !== false) { | ||
rules.push(rightArrow); | ||
} | ||
if (this.options.copyright !== false) { | ||
rules.push(copyright); | ||
} | ||
if (this.options.trademark !== false) { | ||
rules.push(trademark); | ||
} | ||
if (this.options.servicemark !== false) { | ||
rules.push(servicemark); | ||
} | ||
if (this.options.registeredTrademark !== false) { | ||
rules.push(registeredTrademark); | ||
} | ||
if (this.options.oneHalf !== false) { | ||
rules.push(oneHalf); | ||
} | ||
if (this.options.plusMinus !== false) { | ||
rules.push(plusMinus); | ||
} | ||
if (this.options.notEqual !== false) { | ||
rules.push(notEqual); | ||
} | ||
if (this.options.laquo !== false) { | ||
rules.push(laquo); | ||
} | ||
if (this.options.raquo !== false) { | ||
rules.push(raquo); | ||
} | ||
if (this.options.multiplication !== false) { | ||
rules.push(multiplication); | ||
} | ||
if (this.options.superscriptTwo !== false) { | ||
rules.push(superscriptTwo); | ||
} | ||
if (this.options.superscriptThree !== false) { | ||
rules.push(superscriptThree); | ||
} | ||
if (this.options.oneQuarter !== false) { | ||
rules.push(oneQuarter); | ||
} | ||
if (this.options.threeQuarters !== false) { | ||
rules.push(threeQuarters); | ||
} | ||
return rules; | ||
}, | ||
}); | ||
// src/index.ts | ||
var src_default = Typography; | ||
export { | ||
Typography, | ||
closeDoubleQuote, | ||
closeSingleQuote, | ||
copyright, | ||
src_default as default, | ||
ellipsis, | ||
emDash, | ||
laquo, | ||
leftArrow, | ||
multiplication, | ||
notEqual, | ||
oneHalf, | ||
oneQuarter, | ||
openDoubleQuote, | ||
openSingleQuote, | ||
plusMinus, | ||
raquo, | ||
registeredTrademark, | ||
rightArrow, | ||
servicemark, | ||
superscriptThree, | ||
superscriptTwo, | ||
threeQuarters, | ||
trademark | ||
}; | ||
export { Typography, closeDoubleQuote, closeSingleQuote, copyright, Typography as default, ellipsis, emDash, laquo, leftArrow, multiplication, notEqual, oneHalf, oneQuarter, openDoubleQuote, openSingleQuote, plusMinus, raquo, registeredTrademark, rightArrow, servicemark, superscriptThree, superscriptTwo, threeQuarters, trademark }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tiptap/extension-typography", | ||
"description": "typography extension for tiptap", | ||
"version": "2.0.0-beta.213", | ||
"version": "2.0.0-beta.214", | ||
"homepage": "https://tiptap.dev", | ||
@@ -18,3 +18,3 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"types": "./dist/packages/extension-typography/src/index.d.ts", | ||
"import": "./dist/index.js", | ||
@@ -26,3 +26,4 @@ "require": "./dist/index.cjs" | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"umd": "dist/index.umd.js", | ||
"types": "dist/packages/extension-typography/src/index.d.ts", | ||
"files": [ | ||
@@ -36,3 +37,3 @@ "src", | ||
"devDependencies": { | ||
"@tiptap/core": "^2.0.0-beta.213" | ||
"@tiptap/core": "^2.0.0-beta.214" | ||
}, | ||
@@ -45,15 +46,5 @@ "repository": { | ||
"scripts": { | ||
"build": "tsup" | ||
}, | ||
"tsup": { | ||
"entry": [ | ||
"src/index.ts" | ||
], | ||
"dts": true, | ||
"splitting": true, | ||
"format": [ | ||
"esm", | ||
"cjs" | ||
] | ||
"clean": "rm -rf dist", | ||
"build": "npm run clean && rollup -c" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
53997
12
787