diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e827dd9d..6ffb9036 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,7 @@ jobs: with: status: ${{ job.status }} steps: ${{ toJson(steps) }} - channel: '#tiptap-next' + channel: '#tiptap-notifications' if: failure() test: @@ -107,52 +107,52 @@ jobs: with: status: ${{ job.status }} steps: ${{ toJson(steps) }} - channel: '#tiptap-next' + channel: '#tiptap-notifications' if: failure() - build: - runs-on: ubuntu-latest + # build: + # runs-on: ubuntu-latest - needs: lint + # needs: lint - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - strategy: - matrix: - node-version: [14] + # strategy: + # matrix: + # node-version: [14] - steps: + # steps: - - uses: actions/checkout@v2.3.3 + # - uses: actions/checkout@v2.3.3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2.1.2 - with: - node-version: ${{ matrix.node-version }} + # - name: Use Node.js ${{ matrix.node-version }} + # uses: actions/setup-node@v2.1.2 + # with: + # node-version: ${{ matrix.node-version }} - - name: Load cached dependencies - uses: actions/cache@v2 - id: cache - with: - path: | - **/node_modules - /home/runner/.cache/Cypress - key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} + # - name: Load cached dependencies + # uses: actions/cache@v2 + # id: cache + # with: + # path: | + # **/node_modules + # /home/runner/.cache/Cypress + # key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }} - - name: Install dependencies - id: install-dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: yarn install + # - name: Install dependencies + # id: install-dependencies + # if: steps.cache.outputs.cache-hit != 'true' + # run: yarn install - - name: Build packages dependencies - id: build-packages - run: yarn build:packages + # - name: Build packages dependencies + # id: build-packages + # run: yarn build:packages - - name: Send Slack notifications - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#tiptap-next' - if: failure() + # - name: Send Slack notifications + # uses: act10ns/slack@v1 + # with: + # status: ${{ job.status }} + # steps: ${{ toJson(steps) }} + # channel: '#tiptap-notifications' + # if: failure() diff --git a/docs/src/demos/Api/Schema/GenerateHTML/index.vue b/docs/src/demos/Api/Schema/GenerateHTML/index.vue index 875fe64a..b0a6eda4 100644 --- a/docs/src/demos/Api/Schema/GenerateHTML/index.vue +++ b/docs/src/demos/Api/Schema/GenerateHTML/index.vue @@ -1,5 +1,5 @@ + + diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md index 8956e002..e4de828e 100644 --- a/docs/src/docPages/api/commands.md +++ b/docs/src/docPages/api/commands.md @@ -27,35 +27,67 @@ When a user clicks on a button outside of the content, the editor isn’t in foc All chained commands are kind of queued up. They are combined to one single transaction. That means, the content is only updated once, also the `update` event is only triggered once. +## Dry run for commands +Sometimes, you don’t want to actually run the commands, but only know if it would be possible to run commands, for example to show or hide buttons in a menu. Inside of a command you can *try* to execute other commands, without actually changing the content like this: + +```js +commands.try([ + () => commands.splitBlock(), + () => commands.whatever(), +]) +``` + +Outside of components you can do this, too. The editor exposes a try method, which passes all commands and expects an array of commands you want to try: + +```js +editor.try(({ commands }) => [ + () => commands.splitBlock(), + () => commands.whatever(), +]) +``` + +This stops at the first command which return `false`. Commands after that won’t be executed. Even if all commands would be possible to run, none of the changes are applied to the document. + ## List of commands Have a look at all of the core commands listed below. They should give you a good first impression of what’s possible. ### Content -| Command | Description | -| --------------- | ----------------------------------------------------------- | -| .clearContent() | Clear the whole document. | -| .insertgetHTML() | Insert a string of HTML at the currently selected position. | -| .insertText() | Insert a string of text at the currently selected position. | -| .setContent() | Replace the whole document with new content. | +| Command | Description | +| ---------------- | ----------------------------------------------------------- | +| .clearContent() | Clear the whole document. | +| .insertgetHTML() | Insert a string of HTML at the currently selected position. | +| .insertText() | Insert a string of text at the currently selected position. | +| .insertHTML() | | +| .setContent() | Replace the whole document with new content. | ### Nodes & Marks -| Command | Description | -| ------------------- | ------------------------------------------------------ | -| .removeMark() | Remove a mark in the current selection. | -| .removeMarks() | Remove all marks in the current selection. | -| .selectParentNode() | Select the parent node. | -| .toggleMark() | Toggle a mark on and off. | -| .toggleBlockType() | Toggle a node with another node. | -| .setBlockType() | Replace a given range with a node. | -| .updateMark() | Update a mark with new attributes. | +| Command | Description | +| ---------------------- | ------------------------------------------ | +| .clearNodes() | | +| .removeMark() | | +| .removeMark() | Remove a mark in the current selection. | +| .removeMarks() | | +| .removeMarks() | Remove all marks in the current selection. | +| .resetNodeAttributes() | | +| .selectParentNode() | Select the parent node. | +| .setBlockType() | Replace a given range with a node. | +| .setNodeAttributes() | | +| .splitBlock() | Forks a new node from an existing node. | +| .toggleBlockType() | Toggle a node with another node. | +| .toggleMark() | | +| .toggleMark() | Toggle a mark on and off. | +| .toggleWrap() | | +| .updateMark() | | +| .updateMark() | Update a mark with new attributes. | ### Lists -| Command | Description | -| ------------------- | ------------------------------------------------------ | -| .liftListItem() | Lift the list item into a wrapping list. | -| .sinkListItem() | Sink the list item down into an inner list. | -| .splitListItem() | Splits a textblock of a list item into two list items. | -| .toggleList() | Toggle between different list styles. | +| Command | Description | +| ---------------- | ------------------------------------------------------ | +| .liftListItem() | Lift the list item into a wrapping list. | +| .sinkListItem() | Sink the list item down into an inner list. | +| .splitListItem() | Splits a textblock of a list item into two list items. | +| .toggleList() | Toggle between different list styles. | +| .wrapInList() | | ### Selection | Command | Description | @@ -67,4 +99,4 @@ Have a look at all of the core commands listed below. They should give you a goo | .selectAll() | Select the whole document. | ### Extensions -All extension can add additional commands (and most do), check out the specific [documentation for the provided extensions](/api/extensions), [nodes](/api/nodes), and [marks](/api/marks) to learn more about that. Of course, you can [add your custom extensions](/guide/build-custom-extensions) with custom commands aswell. +All extensions can add additional commands (and most do), check out the specific [documentation for the provided nodes](/api/nodes), [marks](/api/marks), and [extensions](/api/extensions) to learn more about those. Of course, you can [add your custom extensions](/guide/build-custom-extensions) with custom commands aswell. diff --git a/docs/src/docPages/api/extensions/focus.md b/docs/src/docPages/api/extensions/focus.md index 6eacca5e..2d011777 100644 --- a/docs/src/docPages/api/extensions/focus.md +++ b/docs/src/docPages/api/extensions/focus.md @@ -15,12 +15,6 @@ yarn add @tiptap/extension-focus | className | string | has-focus | The class that is applied to the focused element. | | nested | boolean | true | When enabled nested elements get the focus class, too. | -## Commands -*None* - -## Keyboard shortcuts -*None* - ## Source code [packages/extension-focus/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-focus/) diff --git a/docs/src/docPages/api/extensions/gapcursor.md b/docs/src/docPages/api/extensions/gapcursor.md index 1f16726b..a42b7ef0 100644 --- a/docs/src/docPages/api/extensions/gapcursor.md +++ b/docs/src/docPages/api/extensions/gapcursor.md @@ -1,4 +1,7 @@ # Gapcursor +This extension loads the [ProseMirror Gapcursor plugin](https://github.com/ProseMirror/prosemirror-gapcursor) by Marijn Haverbeke, which adds a gap for the cursor in places that don’t allow regular selection. For example, after a table at the end of a document. + +Note that tiptap is renderless, but the dropcursor needs CSS for its appearance. The default CSS is added to the usage example below. ## Installation ```bash @@ -9,17 +12,8 @@ npm install @tiptap/extension-gapcursor yarn add @tiptap/extension-gapcursor ``` -## Settings -*None* - -## Commands -*None* - -## Keyboard shortcuts -*None* - ## Source code [packages/extension-gapcursor/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-gapcursor/) ## Usage - + diff --git a/docs/src/docPages/api/keyboard-shortcuts.md b/docs/src/docPages/api/keyboard-shortcuts.md index b1b7afce..a1390fe6 100644 --- a/docs/src/docPages/api/keyboard-shortcuts.md +++ b/docs/src/docPages/api/keyboard-shortcuts.md @@ -9,6 +9,8 @@ tiptap comes with sensible keyboard shortcut defaults. Depending on what you wan Most of the core extensions register their own keyboard shortcuts. Depending on what set of extension you use, not all of the below listed keyboard shortcuts work for your editor. ### Essentials +❌ = untested + | Action | Windows/Linux | macOS | | ------------------------ | ------------------------------- | --------------------------- | | Copy | `Control` `C` | `Cmd` `C` | @@ -17,50 +19,50 @@ Most of the core extensions register their own keyboard shortcuts. Depending on | Paste without formatting | `Control` `Shift` `V` | `Cmd` `Shift` `V` | | Undo | `Control` `Z` | `Cmd` `Z` | | Redo | `Control` `Shift` `Z` | `Cmd` `Shift` `Z` | -| Insert or edit link | `Control` `K` | `Cmd` `K` | -| Open link | `Alt` `Enter` | `Alt` `Enter` | -| Find | `Control` `F` | `Cmd` `F` | -| Find and replace | `Control` `H` | `Cmd` `Shift` `H` | -| Find again | `Control` `G` | `Cmd` `G` | -| Find previous | `Control` `Shift` `G` | `Cmd` `Shift` `G` | -| Repeat last action | `Control` `Y` | `Cmd` `Y` | +| ❌ Insert or edit link | `Control` `K` | `Cmd` `K` | +| ❌ Open link | `Alt` `Enter` | `Alt` `Enter` | +| ❌ Find | `Control` `F` | `Cmd` `F` | +| ❌ Find and replace | `Control` `H` | `Cmd` `Shift` `H` | +| ❌ Find again | `Control` `G` | `Cmd` `G` | +| ❌ Find previous | `Control` `Shift` `G` | `Cmd` `Shift` `G` | +| ❌ Repeat last action | `Control` `Y` | `Cmd` `Y` | | Add a line break | `Shift` `Enter` | `Shift` `Enter` | ### Text Formatting -| Action | Windows/Linux | macOS | -| --------------------- | ------------------------------------------------------- | --------------------------- | -| Bold | `Control` `B` | `Cmd` `B` | -| Italicize | `Control` `I` | `Cmd` `I` | -| Underline | `Control` `U` | `Cmd` `U` | -| Strikethrough | `Alt` `Shift` `5` | `Cmd` `Shift` `X` | -| Superscript | `Control` `.` | `Cmd` `.` | -| Subscript | `Control` `,` | `Cmd` `,` | -| Copy text formatting | `Control` `Alt` `C` | `Cmd` `Alt` `C` | -| Paste text formatting | `Control` `Alt` `V` | `Cmd` `Alt` `V` | -| Clear text formatting | `Control` \
`Control` `Space` | `Cmd` `\` | -| Increase font size | `Control` `Shift` `>` | `Cmd` `Shift` `>` | -| Decrease font size | `Control` `Shift` `<` | `Cmd` `Shift` `<` | +| Action | Windows/Linux | macOS | +| ----------------------- | -------------------------------------------- | --------------------------- | +| Bold | `Control` `B` | `Cmd` `B` | +| Italicize | `Control` `I` | `Cmd` `I` | +| Underline | `Control` `U` | `Cmd` `U` | +| ❌ Strikethrough | `Alt` `Shift` `5` | `Cmd` `Shift` `X` | +| ❌ Superscript | `Control` `.` | `Cmd` `.` | +| ❌ Subscript | `Control` `,` | `Cmd` `,` | +| ❌ Copy text formatting | `Control` `Alt` `C` | `Cmd` `Alt` `C` | +| ❌ Paste text formatting | `Control` `Alt` `V` | `Cmd` `Alt` `V` | +| ❌ Clear text formatting | `Control` `\`
`Control` `Space` | `Cmd` `\` | +| ❌ Increase font size | `Control` `Shift` `>` | `Cmd` `Shift` `>` | +| ❌ Decrease font size | `Control` `Shift` `<` | `Cmd` `Shift` `<` | ### Paragraph Formatting -| Action | Windows/Linux | macOS | -| ------------------------------ | ------------------------------- | ------------------------------- | -| Increase paragraph indentation | `Control` `]` | `Cmd` `]` | -| Decrease paragraph indentation | `Control` `[` | `Cmd` `[` | -| Apply normal text style | `Control` `Alt` `0` | `Cmd` `Alt` `0` | -| Apply heading style 1 | `Control` `Alt` `1` | `Cmd` `Alt` `1` | -| Apply heading style 2 | `Control` `Alt` `2` | `Cmd` `Alt` `2` | -| Apply heading style 3 | `Control` `Alt` `3` | `Cmd` `Alt` `3` | -| Apply heading style 4 | `Control` `Alt` `4` | `Cmd` `Alt` `4` | -| Apply heading style 5 | `Control` `Alt` `5` | `Cmd` `Alt` `5` | -| Apply heading style 6 | `Control` `Alt` `6` | `Cmd` `Alt` `6` | -| Left align | `Control` `Shift` `L` | `Cmd` `Shift` `L` | -| Center align | `Control` `Shift` `E` | `Cmd` `Shift` `E` | -| Right align | `Control` `Shift` `R` | `Cmd` `Shift` `R` | -| Justify | `Control` `Shift` `J` | `Cmd` `Shift` `J` | -| Numbered list | `Control` `Shift` `7` | `Cmd` `Shift` `7` | -| Bulleted list | `Control` `Shift` `8` | `Cmd` `Shift` `8` | -| Move paragraph up | `Control` `Shift` `↑` | `Control` `Shift` `↑` | -| Move paragraph down | `Control` `Shift` `↓` | `Control` `Shift` `↓` | +| Action | Windows/Linux | macOS | +| -------------------------------- | ------------------------------- | ------------------------------- | +| ❌ Increase paragraph indentation | `Control` `]` | `Cmd` `]` | +| ❌ Decrease paragraph indentation | `Control` `[` | `Cmd` `[` | +| Apply normal text style | `Control` `Alt` `0` | `Cmd` `Alt` `0` | +| Apply heading style 1 | `Control` `Alt` `1` | `Cmd` `Alt` `1` | +| Apply heading style 2 | `Control` `Alt` `2` | `Cmd` `Alt` `2` | +| Apply heading style 3 | `Control` `Alt` `3` | `Cmd` `Alt` `3` | +| Apply heading style 4 | `Control` `Alt` `4` | `Cmd` `Alt` `4` | +| Apply heading style 5 | `Control` `Alt` `5` | `Cmd` `Alt` `5` | +| Apply heading style 6 | `Control` `Alt` `6` | `Cmd` `Alt` `6` | +| Left align | `Control` `Shift` `L` | `Cmd` `Shift` `L` | +| Center align | `Control` `Shift` `E` | `Cmd` `Shift` `E` | +| Right align | `Control` `Shift` `R` | `Cmd` `Shift` `R` | +| Justify | `Control` `Shift` `J` | `Cmd` `Shift` `J` | +| ❌ Numbered list | `Control` `Shift` `7` | `Cmd` `Shift` `7` | +| ❌ Bulleted list | `Control` `Shift` `8` | `Cmd` `Shift` `8` | +| ❌ Move paragraph up | `Control` `Shift` `↑` | `Control` `Shift` `↑` | +| ❌ Move paragraph down | `Control` `Shift` `↓` | `Control` `Shift` `↓` | ### Text Selection | Action | Windows/Linux | macOS | @@ -70,10 +72,10 @@ Most of the core extensions register their own keyboard shortcuts. Depending on | Extend selection one character to right | `Shift` `→` | `Shift` `→` | | Extend selection one line up | `Shift` `↑` | `Shift` `↑` | | Extend selection one line down | `Shift` `↓` | `Shift` `↓` | -| Extend selection one paragraph up | `Alt` `Shift` `↑` | `Alt` `Shift` `↑` | -| Extend selection one paragraph down | `Alt` `Shift` `↓` | `Alt` `Shift` `↓` | +| ❌ Extend selection one paragraph up | `Alt` `Shift` `↑` | `Alt` `Shift` `↑` | +| ❌ Extend selection one paragraph down | `Alt` `Shift` `↓` | `Alt` `Shift` `↓` | | Extend selection to the beginning of the document | `Control` `Shift` `↑` | `Cmd` `Shift` `↑` | -| Extend selection to the end of the document | `Control` `Shift` `↓` | `Cmd` `Shift` `↓` | +| ❌ Extend selection to the end of the document | `Control` `Shift` `↓` | `Cmd` `Shift` `↓` | ## Overwrite keyboard shortcuts Keyboard shortcuts may be strings like `'Shift-Control-Enter'`. Keys are based on the strings that can appear in `event.key`, concatenated with a `-`. There is a little tool called [keycode.info](https://keycode.info/), which shows the `event.key` interactively. diff --git a/docs/src/docPages/api/schema.md b/docs/src/docPages/api/schema.md index b41af9bc..7ed2fbbe 100644 --- a/docs/src/docPages/api/schema.md +++ b/docs/src/docPages/api/schema.md @@ -10,10 +10,10 @@ This schema is *very* strict. You can’t use any HTML element or attribute that Let me give you one example: If you paste something like `This is important` into tiptap, don’t have any extension that handles `strong` tags registered, you’ll only see `This is important` – without the strong tags. ## How a schema looks like - -The most simple schema for a typical *ProseMirror* editor is looking something like that: +When you’ll work with the provided extensions only, you don’t have to care that much about the schema. If you’re building your own extensions, it’s probably helpful to understand how the schema works. Let’s look at the most simple schema for a typical ProseMirror editor: ```js +// the underlying ProseMirror schema { nodes: { document: { @@ -32,58 +32,95 @@ The most simple schema for a typical *ProseMirror* editor is looking something l } ``` -:::warning Out of date -This content is written for tiptap 1 and needs an update. -::: - We register three nodes here. `document`, `paragraph` and `text`. `document` is the root node which allows one or more block nodes as children (`content: 'block+'`). Since `paragraph` is in the group of block nodes (`group: 'block'`) our document can only contain paragraphs. Our paragraphs allow zero or more inline nodes as children (`content: 'inline*'`) so there can only be `text` in it. `parseDOM` defines how a node can be parsed from pasted HTML. `toDOM` defines how it will be rendered in the DOM. -In tiptap we define every node in its own `Extension` class instead. This allows us to split logic per node. Under the hood the schema will be merged together. +In tiptap every node, mark and extension is living in its own file. This allows us to split the logic. Under the hood the whole schema will be merged together: ```js -class Document extends Node { - name = 'document' - topNode = true +// the tiptap schema API +import { createNode } from '@tiptap/core' - schema() { - return { - content: 'block+', - } - } -} +const Document = createNode({ + name: 'document', + topNode: true, + content: 'block+', +}) -class Paragraph extends Node { - name = 'paragraph' +const Paragraph = createNode({ + name: 'paragraph', + group: 'block', + content: 'inline*', + parseHTML() { + return [ + { tag: 'p' }, + ] + }, + renderHTML({ attributes }) { + return ['p', attributes, 0] + }, +}) - schema() { - return { - content: 'inline*', - group: 'block', - parseDOM: [{ tag: 'p' }], - toDOM: () => ['p', 0], - } - } -} - -class Text extends Node { - name = 'text' - - schema() { - return { - group: 'inline', - } - } -} +const Text = createNode({ + name: 'text', + group: 'inline', +}) ``` -## Difference between a Node and a Mark +## Nodes and marks -*Nodes* are like blocks of content, for example paragraphs, headings, code blocks, blockquotes and many more. +### Differences +Nodes are like blocks of content, for example paragraphs, headings, code blocks, blockquotes and many more. -*Marks* can apply a different style to specific parts of text inside a *Node*. That’s the case for **bold**, *italic* or ~~striked~~ text. [Links](#) are *Marks*, too. +Marks can be applied to specific parts of a node. That’s the case for **bold**, *italic* or ~~striked~~ text. [Links](#) are marks, too. + +### The node schema + +#### Content +> The content expression for this node, as described in the schema guide. When not given, the node does not allow any content. + +#### Marks +> The marks that are allowed inside of this node. May be a space-separated string referring to mark names or groups, "_" to explicitly allow all marks, or "" to disallow marks. When not given, nodes with inline content default to allowing all marks, other nodes default to not allowing marks. + +#### Group +> The group or space-separated groups to which this node belongs, which can be referred to in the content expressions for the schema. + +#### Inline +> Should be set to true for inline nodes. (Implied for text nodes.) + +#### Atom +> Can be set to true to indicate that, though this isn't a leaf node, it doesn't have directly editable content and should be treated as a single unit in the view. + +#### Selectable +> Controls whether nodes of this type can be selected as a node selection. Defaults to true for non-text nodes. + +#### Draggable +> Determines whether nodes of this type can be dragged without being selected. Defaults to false. + +#### Code +> Can be used to indicate that this node contains code, which causes some commands to behave differently. + +#### Defining +> Determines whether this node is considered an important parent node during replace operations (such as paste). Non-defining (the default) nodes get dropped when their entire content is replaced, whereas defining nodes persist and wrap the inserted content. Likewise, in inserted content the defining parents of the content are preserved when possible. Typically, non-default-paragraph textblock types, and possibly list items, are marked as defining. + +#### Isolating +> When enabled (default is false), the sides of nodes of this type count as boundaries that regular editing operations, like backspacing or lifting, won't cross. An example of a node that should probably have this enabled is a table cell. + +### The mark schema +#### Inclusive +> Whether this mark should be active when the cursor is positioned at its end (or at its start when that is also the start of the parent node). Defaults to true. + +#### Excludes +> Determines which other marks this mark can coexist with. Should be a space-separated strings naming other marks or groups of marks When a mark is added to a set, all marks that it excludes are removed in the process. If the set contains any mark that excludes the new mark but is not, itself, excluded by the new mark, the mark can not be added an the set. You can use the value "_" to indicate that the mark excludes all marks in the schema. + +> Defaults to only being exclusive with marks of the same type. You can set it to an empty string (or any string not containing the mark's own name) to allow multiple marks of a given type to coexist (as long as they have different attributes). + +#### Group +> The group or space-separated groups to which this mark belongs. + +#### Spanning +> Determines whether marks of this type can span multiple adjacent nodes when serialized to DOM/HTML. Defaults to true. ## Get the underlying ProseMirror schema - There are a few use cases where you need to work with the underlying schema. You’ll need that if you’re using the tiptap collaborative text editing features or if you want to manually render your content as HTML. ### Option 1: With an Editor @@ -123,71 +160,3 @@ const schema = getSchema([ // add more extensions here ]) ``` - -## Generate HTML from ProseMirror JSON - -If you need to render the content on the server side, for example to render a blog post which was written with tiptap, you’ll probably need a way to do just that without an actual editor instance. That’s what `generateHTML()` is for. It’s a utility function that renders HTML without an actual editor instance. - -:::info Browser-only rendering -Import a lightweight implementation from `@tiptap/core` if you’re using the function in a browser context only. -::: - - - -### Converting JSON<>HTML with PHP - -We needed to do the same thing in PHP at some point, so we published libraries to convert ProseMirror JSON to HTML and vice-versa: - -* [ueberdosis/prosemirror-php](https://github.com/ueberdosis/prosemirror-php) (PHP) -* [ueberdosis/prosemirror-to-html](https://github.com/ueberdosis/prosemirror-to-html) (PHP) -* [ueberdosis/html-to-prosemirror](https://github.com/ueberdosis/html-to-prosemirror) (PHP) - - -### Node Schema - - -#### Content -> The content expression for this node, as described in the schema guide. When not given, the node does not allow any content. - - -#### Marks -> The marks that are allowed inside of this node. May be a space-separated string referring to mark names or groups, "_" to explicitly allow all marks, or "" to disallow marks. When not given, nodes with inline content default to allowing all marks, other nodes default to not allowing marks. - -#### Group -> The group or space-separated groups to which this node belongs, which can be referred to in the content expressions for the schema. - -#### Inline -> Should be set to true for inline nodes. (Implied for text nodes.) - -#### Atom -> Can be set to true to indicate that, though this isn't a leaf node, it doesn't have directly editable content and should be treated as a single unit in the view. - -#### Selectable -> Controls whether nodes of this type can be selected as a node selection. Defaults to true for non-text nodes. - -#### Draggable -> Determines whether nodes of this type can be dragged without being selected. Defaults to false. - -#### Code -> Can be used to indicate that this node contains code, which causes some commands to behave differently. - -#### Defining -> Determines whether this node is considered an important parent node during replace operations (such as paste). Non-defining (the default) nodes get dropped when their entire content is replaced, whereas defining nodes persist and wrap the inserted content. Likewise, in inserted content the defining parents of the content are preserved when possible. Typically, non-default-paragraph textblock types, and possibly list items, are marked as defining. - -#### Isolating -> When enabled (default is false), the sides of nodes of this type count as boundaries that regular editing operations, like backspacing or lifting, won't cross. An example of a node that should probably have this enabled is a table cell. - -### Mark Schema -#### Inclusive -> Whether this mark should be active when the cursor is positioned at its end (or at its start when that is also the start of the parent node). Defaults to true. - -#### Excludes -> Determines which other marks this mark can coexist with. Should be a space-separated strings naming other marks or groups of marks When a mark is added to a set, all marks that it excludes are removed in the process. If the set contains any mark that excludes the new mark but is not, itself, excluded by the new mark, the mark can not be added an the set. You can use the value "_" to indicate that the mark excludes all marks in the schema. - -> Defaults to only being exclusive with marks of the same type. You can set it to an empty string (or any string not containing the mark's own name) to allow multiple marks of a given type to coexist (as long as they have different attributes). - -#### Group -> The group or space-separated groups to which this mark belongs. - -#### Spanning -> Determines whether marks of this type can span multiple adjacent nodes when serialized to DOM/HTML. Defaults to true. diff --git a/docs/src/docPages/guide/build-custom-extensions.md b/docs/src/docPages/guide/build-custom-extensions.md index f4dd16f3..195d4b8d 100644 --- a/docs/src/docPages/guide/build-custom-extensions.md +++ b/docs/src/docPages/guide/build-custom-extensions.md @@ -289,6 +289,8 @@ const CustomUnderline = Underline.extend({ }) ``` +### Node views + ## Option 2: Start from scratch ### Read the documentation diff --git a/docs/src/docPages/guide/store-content.md b/docs/src/docPages/guide/store-content.md index 7e42b9cd..4380a40a 100644 --- a/docs/src/docPages/guide/store-content.md +++ b/docs/src/docPages/guide/store-content.md @@ -88,3 +88,14 @@ You should really consider to work with HTML or JSON to store your content, they If you still think you need Markdown, [Nextcloud Text](https://github.com/nextcloud/text) uses tiptap 1 to work with Markdown. Their code is open source, so maybe you can learn from them. That said, tiptap **does** support Markdown shortcuts to format your content. Try typing `**two asterisks**` to make your text bold for example. + +## Generate HTML from ProseMirror JSON +If you need to render the content on the server side, for example to render a blog post which was written with tiptap, you’ll probably need a way to do just that without an actual editor instance. + +That’s what `generateHTML()` is for. It’s a utility function that renders HTML without an actual editor instance. + +:::info Browser-only rendering +Import a lightweight implementation from `@tiptap/core` if you’re using the function in a browser context only. +::: + + diff --git a/docs/src/docPages/open.md b/docs/src/docPages/open.md new file mode 100644 index 00000000..62400b83 --- /dev/null +++ b/docs/src/docPages/open.md @@ -0,0 +1,8 @@ +# Monthly reports + +## October 2020 + +## September 2020 + +## August 2020 + diff --git a/docs/src/links.yaml b/docs/src/links.yaml index adf1c1f4..00bdd456 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -173,7 +173,6 @@ draft: true - title: Gapcursor link: /api/extensions/gapcursor - draft: true - title: History link: /api/extensions/history - title: TextAlign @@ -188,14 +187,13 @@ link: /api/events - title: Schema link: /api/schema + draft: true - title: Keyboard Shortcuts link: /api/keyboard-shortcuts - title: Sponsoring items: - # - title: Benefits for sponsors - # link: /benefits-for-sponsors - # - title: Sponsoring reports - # link: /open + - title: Monthly reports + link: /open - title: Become a sponsor link: /sponsor diff --git a/docs/src/templates/DocPage/style.scss b/docs/src/templates/DocPage/style.scss index f0d8fe14..d17cb185 100644 --- a/docs/src/templates/DocPage/style.scss +++ b/docs/src/templates/DocPage/style.scss @@ -265,5 +265,10 @@ } } + > blockquote { + border-left: 2px solid rgba($colorGrey, 0.5); + padding-left: $spacing; + } + } } diff --git a/packages/extension-text-align/index.ts b/packages/extension-text-align/index.ts index 7a6e07ad..dcf499eb 100644 --- a/packages/extension-text-align/index.ts +++ b/packages/extension-text-align/index.ts @@ -52,6 +52,10 @@ const TextAlign = createExtension({ Enter: () => this.editor.splitBlock({ withAttributes: true, }), + 'Ctrl-Shift-l': () => this.editor.textAlign('left'), + 'Ctrl-Shift-e': () => this.editor.textAlign('center'), + 'Ctrl-Shift-r': () => this.editor.textAlign('right'), + 'Ctrl-Shift-j': () => this.editor.textAlign('justify'), } }, })