@tiptap/extension-underline
Advanced tools
Comparing version 3.0.0-next.0 to 3.0.0-next.1
@@ -1,51 +0,52 @@ | ||
import { Mark, mergeAttributes } from '@tiptap/core'; | ||
/** | ||
* This extension allows you to create underline text. | ||
* @see https://www.tiptap.dev/api/marks/underline | ||
*/ | ||
const Underline = Mark.create({ | ||
name: 'underline', | ||
addOptions() { | ||
return { | ||
HTMLAttributes: {}, | ||
}; | ||
}, | ||
parseHTML() { | ||
return [ | ||
{ | ||
tag: 'u', | ||
}, | ||
{ | ||
style: 'text-decoration', | ||
consuming: false, | ||
getAttrs: style => (style.includes('underline') ? {} : false), | ||
}, | ||
]; | ||
}, | ||
renderHTML({ HTMLAttributes }) { | ||
return ['u', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]; | ||
}, | ||
addCommands() { | ||
return { | ||
setUnderline: () => ({ commands }) => { | ||
return commands.setMark(this.name); | ||
}, | ||
toggleUnderline: () => ({ commands }) => { | ||
return commands.toggleMark(this.name); | ||
}, | ||
unsetUnderline: () => ({ commands }) => { | ||
return commands.unsetMark(this.name); | ||
}, | ||
}; | ||
}, | ||
addKeyboardShortcuts() { | ||
return { | ||
'Mod-u': () => this.editor.commands.toggleUnderline(), | ||
'Mod-U': () => this.editor.commands.toggleUnderline(), | ||
}; | ||
}, | ||
// src/underline.ts | ||
import { Mark, mergeAttributes } from "@tiptap/core"; | ||
var Underline = Mark.create({ | ||
name: "underline", | ||
addOptions() { | ||
return { | ||
HTMLAttributes: {} | ||
}; | ||
}, | ||
parseHTML() { | ||
return [ | ||
{ | ||
tag: "u" | ||
}, | ||
{ | ||
style: "text-decoration", | ||
consuming: false, | ||
getAttrs: (style) => style.includes("underline") ? {} : false | ||
} | ||
]; | ||
}, | ||
renderHTML({ HTMLAttributes }) { | ||
return ["u", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]; | ||
}, | ||
addCommands() { | ||
return { | ||
setUnderline: () => ({ commands }) => { | ||
return commands.setMark(this.name); | ||
}, | ||
toggleUnderline: () => ({ commands }) => { | ||
return commands.toggleMark(this.name); | ||
}, | ||
unsetUnderline: () => ({ commands }) => { | ||
return commands.unsetMark(this.name); | ||
} | ||
}; | ||
}, | ||
addKeyboardShortcuts() { | ||
return { | ||
"Mod-u": () => this.editor.commands.toggleUnderline(), | ||
"Mod-U": () => this.editor.commands.toggleUnderline() | ||
}; | ||
} | ||
}); | ||
export { Underline, Underline as default }; | ||
//# sourceMappingURL=index.js.map | ||
// src/index.ts | ||
var src_default = Underline; | ||
export { | ||
Underline, | ||
src_default as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tiptap/extension-underline", | ||
"description": "underline extension for tiptap", | ||
"version": "3.0.0-next.0", | ||
"version": "3.0.0-next.1", | ||
"homepage": "https://tiptap.dev", | ||
@@ -18,3 +18,3 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/packages/extension-underline/src/index.d.ts", | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
@@ -26,4 +26,3 @@ "require": "./dist/index.cjs" | ||
"module": "dist/index.js", | ||
"umd": "dist/index.umd.js", | ||
"types": "dist/packages/extension-underline/src/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
@@ -34,6 +33,6 @@ "src", | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.0" | ||
"@tiptap/core": "^3.0.0-next.1" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^3.0.0-next.0" | ||
"@tiptap/core": "^3.0.0-next.1" | ||
}, | ||
@@ -46,5 +45,4 @@ "repository": { | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"build": "npm run clean && rollup -c" | ||
"build": "tsup" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
606162
15863
10
240
1
169
3
7
0
66