Merge branch 'main' of github.com:ueberdosis/tiptap-next into main

This commit is contained in:
Hans Pagel 2020-11-11 14:08:53 +01:00
commit aa4441edc5
85 changed files with 138 additions and 141 deletions

View File

@ -111,7 +111,7 @@ module.exports = function (api) {
.map(name => name.replace('../packages/', ''))
.forEach(name => {
config.resolve.alias
.set(`@tiptap/${name}`, path.resolve(`../packages/${name}/index.ts`))
.set(`@tiptap/${name}`, path.resolve(`../packages/${name}/src/index.ts`))
})
})
}

View File

@ -14,6 +14,7 @@
"start": "yarn --cwd ./docs start",
"build:docs": "yarn --cwd ./docs build",
"build:packages": "yarn clean:packages && rollup -c",
"build:ci": "yarn clean:packages && rollup -c --ci",
"clean:packages": "rm -rf ./packages/*/dist",
"lint": "eslint --quiet --no-error-on-unmatched-pattern ./",
"test:open": "cypress open --project tests",

View File

@ -1,16 +0,0 @@
export { Editor, Command, CommandsSpec } from './src/Editor'
export * from './src/Extension'
export * from './src/NodeExtension'
export * from './src/MarkExtension'
export * from './src/types'
export { default as nodeInputRule } from './src/inputRules/nodeInputRule'
export { default as markInputRule } from './src/inputRules/markInputRule'
export { default as markPasteRule } from './src/pasteRules/markPasteRule'
export { default as getSchema } from './src/utils/getSchema'
export { default as generateHTML } from './src/utils/generateHTML'
export { default as getHTMLFromFragment } from './src/utils/getHTMLFromFragment'
export { default as getMarkAttrs } from './src/utils/getMarkAttrs'
export { default as mergeAttributes } from './src/utils/mergeAttributes'

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/core",
"version": "2.0.0",
"source": "index.ts",
"main": "dist/tiptap-core.cjs.js",
"umd": "dist/tiptap-core.umd.js",
"module": "dist/tiptap-core.esm.js",
@ -22,8 +21,5 @@
"prosemirror-tables": "^1.1.1",
"prosemirror-utils": "^1.0.0-0",
"prosemirror-view": "^1.16.1"
},
"scripts": {
"build": "microbundle"
}
}

View File

@ -267,8 +267,6 @@ export class Editor extends EventEmitter {
}),
})
console.log({ plugins: this.extensionManager.plugins })
// `editor.view` is not yet available at this time.
// Therefore we will add all plugins and node views directly afterwards.
const newState = this.state.reconfigure({

View File

@ -63,7 +63,7 @@ export const Commands = createExtension({
},
})
declare module '../Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Commands: typeof Commands,
}

View File

@ -15,7 +15,7 @@ export const Editable = createExtension({
})
// TODO: Editable circularly references itself!?
// declare module '../Editor' {
// declare module '@tiptap/core' {
// interface AllExtensions {
// Editable: typeof Editable,
// }

View File

@ -36,7 +36,7 @@ export const FocusEvents = createExtension({
},
})
declare module '../Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
FocusEvents: typeof FocusEvents,
}

View File

@ -45,7 +45,7 @@ export const Keymap = createExtension({
},
})
declare module '../Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Keymap: typeof Keymap,
}

View File

@ -0,0 +1,21 @@
export {
Editor,
Command,
CommandsSpec,
AllExtensions,
} from './Editor'
export * from './Extension'
export * from './NodeExtension'
export * from './MarkExtension'
export * from './types'
export { default as nodeInputRule } from './inputRules/nodeInputRule'
export { default as markInputRule } from './inputRules/markInputRule'
export { default as markPasteRule } from './pasteRules/markPasteRule'
export { default as getSchema } from './utils/getSchema'
export { default as generateHTML } from './utils/generateHTML'
export { default as getHTMLFromFragment } from './utils/getHTMLFromFragment'
export { default as getMarkAttrs } from './utils/getMarkAttrs'
export { default as mergeAttributes } from './utils/mergeAttributes'

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-blockquote",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-blockquote.cjs.js",
"umd": "dist/tiptap-extension-blockquote.umd.js",
"module": "dist/tiptap-extension-blockquote.esm.js",

View File

@ -45,7 +45,7 @@ const Blockquote = createNode({
export default Blockquote
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Blockquote: typeof Blockquote,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-bold",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-bold.cjs.js",
"umd": "dist/tiptap-extension-bold.umd.js",
"module": "dist/tiptap-extension-bold.esm.js",

View File

@ -64,7 +64,7 @@ const Bold = createMark({
export default Bold
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Bold: typeof Bold,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-bullet-list",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-bullet-list.cjs.js",
"umd": "dist/tiptap-extension-bullet-list.umd.js",
"module": "dist/tiptap-extension-bullet-list.esm.js",

View File

@ -43,7 +43,7 @@ const BulletList = createNode({
export default BulletList
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
BulletList: typeof BulletList,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-code-block",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-code-block.cjs.js",
"umd": "dist/tiptap-extension-code-block.umd.js",
"module": "dist/tiptap-extension-code-block.esm.js",

View File

@ -9,7 +9,7 @@ export const backtickInputRegex = /^```(?<language>[a-z]*)? $/
export const tildeInputRegex = /^~~~(?<language>[a-z]*)? $/
const CodeBlock = createNode({
name: 'code_block',
name: 'codeBlock',
defaultOptions: <CodeBlockOptions>{
languageClassPrefix: 'language-',
@ -71,7 +71,7 @@ const CodeBlock = createNode({
addCommands() {
return {
codeBlock: (attrs?: CodeBlockOptions): Command => ({ commands }) => {
return commands.toggleBlockType('code_block', 'paragraph', attrs)
return commands.toggleBlockType('codeBlock', 'paragraph', attrs)
},
}
},
@ -92,7 +92,7 @@ const CodeBlock = createNode({
export default CodeBlock
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
CodeBlock: typeof CodeBlock,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-code",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-code.cjs.js",
"umd": "dist/tiptap-extension-code.umd.js",
"module": "dist/tiptap-extension-code.esm.js",

View File

@ -49,7 +49,7 @@ const Code = createMark({
export default Code
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Code: typeof Code,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-collaboration-cursor",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-collaboration-cursor.cjs.js",
"umd": "dist/tiptap-extension-collaboration-cursor.umd.js",
"module": "dist/tiptap-extension-collaboration-cursor.esm.js",

View File

@ -61,7 +61,7 @@ const CollaborationCursor = createExtension({
export default CollaborationCursor
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
CollaborationCursor: typeof CollaborationCursor,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-collaboration",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-collaboration.cjs.js",
"umd": "dist/tiptap-extension-collaboration.umd.js",
"module": "dist/tiptap-extension-collaboration.esm.js",

View File

@ -32,7 +32,7 @@ const Collaboration = createExtension({
export default Collaboration
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Collaboration: typeof Collaboration,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-document",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-document.cjs.js",
"umd": "dist/tiptap-extension-document.umd.js",
"module": "dist/tiptap-extension-document.esm.js",

View File

@ -8,7 +8,7 @@ const Document = createNode({
export default Document
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Document: typeof Document,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-dropcursor",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-dropcursor.cjs.js",
"umd": "dist/tiptap-extension-dropcursor.umd.js",
"module": "dist/tiptap-extension-dropcursor.esm.js",

View File

@ -11,7 +11,7 @@ const Dropcursor = createExtension({
export default Dropcursor
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Dropcursor: typeof Dropcursor,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-focus",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-focus.cjs.js",
"umd": "dist/tiptap-extension-focus.umd.js",
"module": "dist/tiptap-extension-focus.esm.js",

View File

@ -50,7 +50,7 @@ const FocusClasses = createExtension({
export default FocusClasses
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
FocusClasses: typeof FocusClasses,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-font-family",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-font-family.cjs.js",
"umd": "dist/tiptap-extension-font-family.umd.js",
"module": "dist/tiptap-extension-font-family.esm.js",

View File

@ -49,7 +49,7 @@ const FontFamily = createExtension({
export default FontFamily
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
FontFamily: typeof FontFamily,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-gapcursor",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-gapcursor.cjs.js",
"umd": "dist/tiptap-extension-gapcursor.umd.js",
"module": "dist/tiptap-extension-gapcursor.esm.js",

View File

@ -11,7 +11,7 @@ const Gapcursor = createExtension({
export default Gapcursor
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Gapcursor: typeof Gapcursor,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-hard-break",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-hard-break.cjs.js",
"umd": "dist/tiptap-extension-hard-break.umd.js",
"module": "dist/tiptap-extension-hard-break.esm.js",

View File

@ -47,7 +47,7 @@ const HardBreak = createNode({
export default HardBreak
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
HardBreak: typeof HardBreak,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-heading",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-heading.cjs.js",
"umd": "dist/tiptap-extension-heading.umd.js",
"module": "dist/tiptap-extension-heading.esm.js",

View File

@ -38,7 +38,12 @@ const Heading = createNode({
},
renderHTML({ node, attributes }) {
return [`h${node.attrs.level}`, attributes, 0]
const hasLevel = this.options.levels.includes(node.attrs.level)
const level = hasLevel
? node.attrs.level
: this.options.levels[0]
return [`h${level}`, attributes, 0]
},
addCommands() {
@ -47,6 +52,10 @@ const Heading = createNode({
* heading command
*/
heading: (options: { level: Level }): Command => ({ commands }) => {
if (!this.options.levels.includes(options.level)) {
return false
}
return commands.toggleBlockType('heading', 'paragraph', options)
},
}
@ -70,7 +79,7 @@ const Heading = createNode({
export default Heading
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Heading: typeof Heading,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-highlight",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-highlight.cjs.js",
"umd": "dist/tiptap-extension-highlight.umd.js",
"module": "dist/tiptap-extension-highlight.esm.js",

View File

@ -75,7 +75,7 @@ const Highlight = createMark({
export default Highlight
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Highlight: typeof Highlight,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-history",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-history.cjs.js",
"umd": "dist/tiptap-extension-history.umd.js",
"module": "dist/tiptap-extension-history.esm.js",

View File

@ -40,7 +40,7 @@ const History = createExtension({
export default History
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
History: typeof History,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-horizontal-rule",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-horizontal-rule.cjs.js",
"umd": "dist/tiptap-extension-horizontal-rule.umd.js",
"module": "dist/tiptap-extension-horizontal-rule.esm.js",

View File

@ -34,7 +34,7 @@ const HorizontalRule = createNode({
export default HorizontalRule
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
HorizontalRule: typeof HorizontalRule,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-image",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-image.cjs.js",
"umd": "dist/tiptap-extension-image.umd.js",
"module": "dist/tiptap-extension-image.esm.js",

View File

@ -75,7 +75,7 @@ const Image = createNode({
export default Image
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Image: typeof Image,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-italic",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-italic.cjs.js",
"umd": "dist/tiptap-extension-italic.umd.js",
"module": "dist/tiptap-extension-italic.esm.js",

View File

@ -60,7 +60,7 @@ const Italic = createMark({
export default Italic
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Italic: typeof Italic,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-link",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-link.cjs.js",
"umd": "dist/tiptap-extension-link.umd.js",
"module": "dist/tiptap-extension-link.esm.js",

View File

@ -89,7 +89,7 @@ const Link = createMark({
export default Link
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Link: typeof Link,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-list-item",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-list-item.cjs.js",
"umd": "dist/tiptap-extension-list-item.umd.js",
"module": "dist/tiptap-extension-list-item.esm.js",

View File

@ -30,7 +30,7 @@ const ListItem = createNode({
export default ListItem
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
ListItem: typeof ListItem,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-ordered-list",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-ordered-list.cjs.js",
"umd": "dist/tiptap-extension-ordered-list.umd.js",
"module": "dist/tiptap-extension-ordered-list.esm.js",

View File

@ -67,7 +67,7 @@ const OrderedList = createNode({
export default OrderedList
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
OrderedList: typeof OrderedList,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-paragraph",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-paragraph.cjs.js",
"umd": "dist/tiptap-extension-paragraph.umd.js",
"module": "dist/tiptap-extension-paragraph.esm.js",

View File

@ -35,7 +35,7 @@ const Paragraph = createNode({
export default Paragraph
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Paragraph: typeof Paragraph,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-strike",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-strike.cjs.js",
"umd": "dist/tiptap-extension-strike.umd.js",
"module": "dist/tiptap-extension-strike.esm.js",

View File

@ -58,7 +58,7 @@ const Strike = createMark({
export default Strike
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Strike: typeof Strike,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-task-item",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-task-item.cjs.js",
"umd": "dist/tiptap-extension-task-item.umd.js",
"module": "dist/tiptap-extension-task-item.esm.js",

View File

@ -121,7 +121,7 @@ const TaskItem = createNode({
export default TaskItem
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
TaskItem: typeof TaskItem,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-task-list",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-task-list.cjs.js",
"umd": "dist/tiptap-extension-task-list.umd.js",
"module": "dist/tiptap-extension-task-list.esm.js",

View File

@ -31,7 +31,7 @@ const TaskList = createNode({
export default TaskList
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
TaskList: typeof TaskList,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-text-align",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-text-align.cjs.js",
"umd": "dist/tiptap-extension-text-align.umd.js",
"module": "dist/tiptap-extension-text-align.esm.js",

View File

@ -62,7 +62,7 @@ const TextAlign = createExtension({
export default TextAlign
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
TextAlign: typeof TextAlign,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-text-style",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-text-style.cjs.js",
"umd": "dist/tiptap-extension-text-style.umd.js",
"module": "dist/tiptap-extension-text-style.esm.js",

View File

@ -43,7 +43,7 @@ const TextStyle = createMark({
export default TextStyle
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
TextStyle: typeof TextStyle,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-text",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-text.cjs.js",
"umd": "dist/tiptap-extension-text.umd.js",
"module": "dist/tiptap-extension-text.esm.js",

View File

@ -7,7 +7,7 @@ const Text = createNode({
export default Text
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Text: typeof Text,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-typography",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-typography.cjs.js",
"umd": "dist/tiptap-extension-typography.umd.js",
"module": "dist/tiptap-extension-typography.esm.js",

View File

@ -45,7 +45,7 @@ const Typography = createExtension({
export default Typography
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Typography: typeof Typography,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/extension-underline",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-extension-underline.cjs.js",
"umd": "dist/tiptap-extension-underline.umd.js",
"module": "dist/tiptap-extension-underline.esm.js",

View File

@ -35,7 +35,7 @@ const Underline = createMark({
export default Underline
declare module '@tiptap/core/src/Editor' {
declare module '@tiptap/core' {
interface AllExtensions {
Underline: typeof Underline,
}

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/html",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-html.cjs.js",
"umd": "dist/tiptap-html.umd.js",
"module": "dist/tiptap-html.esm.js",

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/starter-kit",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-starter-kit.cjs.js",
"umd": "dist/tiptap-starter-kit.umd.js",
"module": "dist/tiptap-starter-kit.esm.js",

View File

@ -3,12 +3,12 @@ import Gapcursor from '@tiptap/extension-gapcursor'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import History from '@tiptap/extension-history'
import History, { HistoryOptions } from '@tiptap/extension-history'
import Bold from '@tiptap/extension-bold'
import Italic from '@tiptap/extension-italic'
import Code from '@tiptap/extension-code'
import CodeBlock from '@tiptap/extension-code-block'
import Heading from '@tiptap/extension-heading'
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
import Heading, { HeadingOptions } from '@tiptap/extension-heading'
import HardBreak from '@tiptap/extension-hard-break'
import Strike from '@tiptap/extension-strike'
import Blockquote from '@tiptap/extension-blockquote'
@ -17,19 +17,23 @@ import BulletList from '@tiptap/extension-bullet-list'
import OrderedList from '@tiptap/extension-ordered-list'
import ListItem from '@tiptap/extension-list-item'
export function defaultExtensions() {
export function defaultExtensions(options: {
history: HistoryOptions,
codeBlock: CodeBlockOptions,
heading: HeadingOptions,
}) {
return [
Dropcursor(),
Gapcursor(),
Document(),
History(),
History(options?.history),
Paragraph(),
Text(),
Bold(),
Italic(),
Code(),
CodeBlock(),
Heading(),
CodeBlock(options?.codeBlock),
Heading(options?.heading),
HardBreak(),
Strike(),
Blockquote(),

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/vue-starter-kit",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-vue-starter-kit.cjs.js",
"umd": "dist/tiptap-vue-starter-kit.umd.js",
"module": "dist/tiptap-vue-starter-kit.esm.js",

View File

@ -1,3 +0,0 @@
export * from '@tiptap/core'
export { default as VueRenderer } from './src/VueRenderer'
export { default as EditorContent } from './src/components/EditorContent'

View File

@ -1,7 +1,6 @@
{
"name": "@tiptap/vue",
"version": "1.0.0",
"source": "index.ts",
"main": "dist/tiptap-vue.cjs.js",
"umd": "dist/tiptap-vue.umd.js",
"module": "dist/tiptap-vue.esm.js",

View File

@ -0,0 +1,3 @@
export * from '@tiptap/core'
export { default as VueRenderer } from './VueRenderer'
export { default as EditorContent } from './components/EditorContent'

View File

@ -24,16 +24,17 @@ async function build(commandLineArgs) {
const config = []
// Support --scope and --ignore globs if passed in via commandline
const { scope, ignore } = minimist(process.argv.slice(2))
const { scope, ignore, ci } = minimist(process.argv.slice(2))
const packages = await getSortedPackages(scope, ignore)
// prevent rollup warning
delete commandLineArgs.ci
delete commandLineArgs.scope
delete commandLineArgs.ignore
packages.forEach(pkg => {
const basePath = path.relative(__dirname, pkg.location)
const input = path.join(basePath, 'index.ts')
const input = path.join(basePath, 'src/index.ts')
const {
name,
main,
@ -42,16 +43,9 @@ async function build(commandLineArgs) {
unpkg,
} = pkg.toJSON()
const plugins = [
const basePlugins = [
resolve(),
commonjs(),
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: true,
},
},
}),
vuePlugin(),
babel({
babelHelpers: 'bundled',
@ -87,30 +81,54 @@ async function build(commandLineArgs) {
...Object.keys(pkg.devDependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
plugins,
plugins: [
...basePlugins,
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: true,
paths: {
'@tiptap/*': ['*/src'],
},
},
include: null,
},
}),
],
})
config.push({
input,
output: [
{
name,
file: path.join(basePath, unpkg),
format: 'umd',
sourcemap: true,
globals: {
vue: 'Vue',
if (!ci) {
config.push({
input,
output: [
{
name,
file: path.join(basePath, unpkg),
format: 'umd',
sourcemap: true,
globals: {
vue: 'Vue',
},
},
},
],
externals: [
'vue',
],
plugins: [
...plugins,
terser(),
],
})
],
external: [
'vue',
],
plugins: [
...basePlugins,
typescript({
tsconfigOverride: {
compilerOptions: {
paths: {
'@tiptap/*': ['*/src'],
},
},
},
}),
terser(),
],
})
}
})
return config

View File

@ -10,13 +10,11 @@
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"sourceMap": true,
"baseUrl": ".",
"baseUrl": "./packages",
"allowJs": false,
"checkJs": false,
"paths": {
"@/*": [
"packages/*"
]
"@tiptap/*": ["*/dist", "*/src"]
},
"lib": [
"esnext",
@ -28,6 +26,9 @@
"files": [
"./shims/vue.d.ts"
],
"include": [
"**/*.ts"
],
"exclude": [
"**/node_modules",
"**/dist"