From 64da5cbcf78ebf2dc4ef756a39487b36b7de8976 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 2 Oct 2020 14:54:10 +0200 Subject: [PATCH 001/116] add tilde markdown shortcut support to code blocks --- .../demos/Extensions/CodeBlock/index.spec.js | 46 ++++++++++++++----- packages/extension-code-block/index.ts | 6 ++- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index 746605c0..7da58542 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -58,17 +58,6 @@ context('/api/extensions/code-block', () => { .should('not.exist') }) - it('should make a code block from markdown shortcuts', () => { - cy.get('.ProseMirror').then(([{ editor }]) => { - editor.clearContent() - - cy.get('.ProseMirror') - .type('``` Code') - .find('pre>code') - .should('contain', 'Code') - }) - }) - it('should parse the language from a HTML code block', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('
body { display: none; }
') @@ -79,7 +68,29 @@ context('/api/extensions/code-block', () => { }) }) - it('should make a code block for js', () => { + it('should make a code block from backtick markdown shortcuts', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + + cy.get('.ProseMirror') + .type('``` Code') + .find('pre>code') + .should('contain', 'Code') + }) + }) + + it('should make a code block from tilde markdown shortcuts', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + + cy.get('.ProseMirror') + .type('~~~ Code') + .find('pre>code') + .should('contain', 'Code') + }) + }) + + it('should make a code block for js with backticks', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.clearContent() @@ -89,4 +100,15 @@ context('/api/extensions/code-block', () => { .should('contain', 'Code') }) }) + + it('should make a code block for js with tildes', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + + cy.get('.ProseMirror') + .type('~~~js Code') + .find('pre>code.language-js') + .should('contain', 'Code') + }) + }) }) diff --git a/packages/extension-code-block/index.ts b/packages/extension-code-block/index.ts index 4119e7ec..9b69b8fb 100644 --- a/packages/extension-code-block/index.ts +++ b/packages/extension-code-block/index.ts @@ -13,7 +13,8 @@ declare module '@tiptap/core/src/Editor' { } } -export const inputRegex = /^```(?[a-z]*)? $/ +export const backtickInputRegex = /^```(?[a-z]*)? $/ +export const tildeInputRegex = /^~~~(?[a-z]*)? $/ export default new Node() .name('code_block') @@ -62,6 +63,7 @@ export default new Node() 'Shift-Control-\\': () => editor.codeBlock(), })) .inputRules(({ type }) => [ - textblockTypeInputRule(inputRegex, type, ({ groups }: any) => groups), + textblockTypeInputRule(backtickInputRegex, type, ({ groups }: any) => groups), + textblockTypeInputRule(tildeInputRegex, type, ({ groups }: any) => groups), ]) .create() From eeec5b68718db612f1919642859e2f0b4e3a78bf Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 2 Oct 2020 15:05:26 +0200 Subject: [PATCH 002/116] change markdown shortcut for striked text to two tildes --- docs/src/demos/Extensions/Strike/index.spec.js | 2 +- docs/src/docPages/api/extensions/strike.md | 2 +- packages/extension-strike/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js index ad51e03f..54db052b 100644 --- a/docs/src/demos/Extensions/Strike/index.spec.js +++ b/docs/src/demos/Extensions/Strike/index.spec.js @@ -51,7 +51,7 @@ context('/api/extensions/strike', () => { it('should make a striked text from the markdown shortcut', () => { cy.get('.ProseMirror') - .type('~Strike~') + .type('~~Strike~~') .find('s') .should('contain', 'Strike') }) diff --git a/docs/src/docPages/api/extensions/strike.md b/docs/src/docPages/api/extensions/strike.md index 15729c2e..4cff00dd 100644 --- a/docs/src/docPages/api/extensions/strike.md +++ b/docs/src/docPages/api/extensions/strike.md @@ -1,7 +1,7 @@ # Strike Use this extension to render ~~striked text~~. If you pass ``, ``, `` tags, or text with inline `style` attributes setting `text-decoration: line-through` in the editor’s initial content, they all will be rendered accordingly. -Type ~text between tildes~ and it will be magically ~~striked through~~ while you type. +Type ∼∼text between tildes∼∼ and it will be magically ~~striked through~~ while you type. ::: warning Restrictions The extension will generate the corresponding `` HTML tags when reading contents of the `Editor` instance. All text striked through, regardless of the method will be normalized to `` HTML tags. diff --git a/packages/extension-strike/index.ts b/packages/extension-strike/index.ts index 2f33e1cc..2813884e 100644 --- a/packages/extension-strike/index.ts +++ b/packages/extension-strike/index.ts @@ -10,8 +10,8 @@ declare module '@tiptap/core/src/Editor' { } } -export const inputRegex = /(?:^|\s)((?:~)((?:[^~]+))(?:~))$/gm -export const pasteRegex = /(?:^|\s)((?:~)((?:[^~]+))(?:~))/gm +export const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm +export const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/gm export default new Mark() .name('strike') From 26504027b746c7c7df5e23a2baedb5fc04346b95 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Fri, 2 Oct 2020 15:12:01 +0200 Subject: [PATCH 003/116] update the documentation --- docs/src/docPages/api/extensions/code-block.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/docPages/api/extensions/code-block.md b/docs/src/docPages/api/extensions/code-block.md index 6608c521..a87e56d3 100644 --- a/docs/src/docPages/api/extensions/code-block.md +++ b/docs/src/docPages/api/extensions/code-block.md @@ -1,7 +1,7 @@ # CodeBlock With the CodeBlock extension you can add fenced code blocks to your documents. It’ll wrap the code in `
` and `` HTML tags.
 
-Type three backticks and a space ``` and a code block is instantly added for you.
+Type ```  (three backticks and a space) or ∼∼∼  (three tildes and a space) and a code block is instantly added for you. You can even specify the language, try writing ```css . That should add a `language-css` class to the ``-tag.
 
 ::: warning Restrictions
 The CodeBlock extension doesn’t come with styling and has no syntax highlighting built-in. It’s on our roadmap though.

From eabcecb550e90b37be7dbb697b0f58ea4604cf91 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 15:45:45 +0200
Subject: [PATCH 004/116] add comment about broken autoFocus option

---
 docs/src/demos/Examples/Focus/index.spec.js | 2 --
 docs/src/demos/Examples/Focus/index.vue     | 2 +-
 docs/src/links.yaml                         | 4 ++--
 packages/core/src/Editor.ts                 | 7 +++++++
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/docs/src/demos/Examples/Focus/index.spec.js b/docs/src/demos/Examples/Focus/index.spec.js
index f36629de..1c7271a6 100644
--- a/docs/src/demos/Examples/Focus/index.spec.js
+++ b/docs/src/demos/Examples/Focus/index.spec.js
@@ -5,8 +5,6 @@ context('/examples/focus', () => {
 
   it('should have class', () => {
     cy.get('.ProseMirror').then(([{ editor }]) => {
-      editor.focus('start')
-
       cy.get('.ProseMirror p:first').should('have.class', 'has-focus')
     })
   })
diff --git a/docs/src/demos/Examples/Focus/index.vue b/docs/src/demos/Examples/Focus/index.vue
index 063f9212..033c14da 100644
--- a/docs/src/demos/Examples/Focus/index.vue
+++ b/docs/src/demos/Examples/Focus/index.vue
@@ -1,5 +1,5 @@
 
diff --git a/docs/src/links.yaml b/docs/src/links.yaml
index 94e80146..fb415661 100644
--- a/docs/src/links.yaml
+++ b/docs/src/links.yaml
@@ -56,8 +56,8 @@
         # - title: Placeholder
         #   link: /examples/placeholder
         #   draft: true
-        # - title: Focus
-        #   link: /examples/focus
+        - title: Focus
+          link: /examples/focus
         # - title: Title
         #   link: /examples/title
         #   draft: true
diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts
index 2be9f517..87e50e39 100644
--- a/packages/core/src/Editor.ts
+++ b/packages/core/src/Editor.ts
@@ -122,7 +122,14 @@ export class Editor extends EventEmitter {
     this.registerCommands(coreCommands)
     this.injectCSS()
 
+    // TODO: The autoFocus option has no impact
+    // Doesn’t work
     this.proxy.focus(this.options.autoFocus)
+    // Does work
+    // window.setTimeout(() => {
+    //   console.log(this.options.autoFocus)
+    //   this.proxy.focus(this.options.autoFocus)
+    // }, 100)
   }
 
   /**

From 6baa758ec321098d42b3bda7dffa766458f127a0 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 15:49:58 +0200
Subject: [PATCH 005/116] clean up the test

---
 docs/src/demos/Examples/Focus/index.spec.js | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/docs/src/demos/Examples/Focus/index.spec.js b/docs/src/demos/Examples/Focus/index.spec.js
index 1c7271a6..029eb69e 100644
--- a/docs/src/demos/Examples/Focus/index.spec.js
+++ b/docs/src/demos/Examples/Focus/index.spec.js
@@ -4,8 +4,6 @@ context('/examples/focus', () => {
   })
 
   it('should have class', () => {
-    cy.get('.ProseMirror').then(([{ editor }]) => {
-      cy.get('.ProseMirror p:first').should('have.class', 'has-focus')
-    })
+    cy.get('.ProseMirror p:first').should('have.class', 'has-focus')
   })
 })

From a03dfaf28d35a824ccccc5fb7c7c177b71abf66f Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 16:56:02 +0200
Subject: [PATCH 006/116] add content to the commands page

---
 docs/src/docPages/api/commands.md | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md
index b32d9187..d859e6ab 100644
--- a/docs/src/docPages/api/commands.md
+++ b/docs/src/docPages/api/commands.md
@@ -3,16 +3,31 @@
 ## Table of Contents
 
 ## Introduction
+The editor provides a ton of commands to programmtically add or change content or alter the selection. If you want to build your own editor you definitely want to learn more about them.
+
+## Execute a command
+All available commands are accessible through an editor instance. Let’s say you want to make text bold when a user clicks on a button. That’s how that would look like:
+
+```js
+editor.bold()
+```
+
+While that’s perfectly fine and does make the selected bold, you’d likely want to change multiple commands in one run. Let’s have a look at how that works.
 
 ## Chain commands
+Most commands can be executed combined to one call. First of all, that’s shorter than separate function call in most cases. Here is an example to make the selected text bold:
 
 ```js
 editor.chain().focus().bold().run()
 ```
 
-## List of commands
+The `.chain()` is required to start a new chain and the `.run()` is needed to actually execute all the commands in between. Between those two functions, this example combines to different commands.
 
-### Content
+When a user clicks on a button outside of the content, the editor isn’t in focus anymore. That’s why you probably want to add a `.focus()` call to most of your commands, that brings back the focus to the editor and the user can continue to type.
+
+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.
+
+## Content
 | Command         | Description                                                 |
 | --------------- | ----------------------------------------------------------- |
 | .clearContent() | Clear the whole document.                                   |
@@ -20,7 +35,7 @@ editor.chain().focus().bold().run()
 | .insertText()   | Insert a string of text at the currently selected position. |
 | .setContent()   | Replace the whole document with new content.                |
 
-### Nodes & Marks
+## Nodes & Marks
 | Command             | Description                                            |
 | ------------------- | ------------------------------------------------------ |
 | .removeMark()       | Remove a mark in the current selection.                |
@@ -31,7 +46,7 @@ editor.chain().focus().bold().run()
 | .setBlockType()     | Replace a given range with a node.                     |
 | .updateMark()       | Update a mark with new attributes.                     |
 
-### Lists
+## Lists
 | Command             | Description                                            |
 | ------------------- | ------------------------------------------------------ |
 | .liftListItem()     | Lift the list item into a wrapping list.               |
@@ -39,7 +54,7 @@ editor.chain().focus().bold().run()
 | .splitListItem()    | Splits a textblock of a list item into two list items. |
 | .toggleList()       | Toggle between different list styles.                  |
 
-### Selection
+## Selection
 | Command            | Description                             |
 | ------------------ | --------------------------------------- |
 | .blur()            | Blurs the editor.                       |
@@ -47,3 +62,6 @@ editor.chain().focus().bold().run()
 | .focus()           | Focus the editor at the given position. |
 | .scrollIntoView()  | Scroll the selection into view.         |
 | .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) to learn more about that. Of course, you can [add your custom extensions](/guide/custom-extensions) with custom commands aswell.

From 95c9c7cc0eef72c07dd1a51e973f4c79525b2c90 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 17:22:38 +0200
Subject: [PATCH 007/116] minor improvement to the commands page

---
 docs/src/docPages/api/commands.md | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md
index d859e6ab..90818b41 100644
--- a/docs/src/docPages/api/commands.md
+++ b/docs/src/docPages/api/commands.md
@@ -27,7 +27,10 @@ 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.
 
-## Content
+## 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.                                   |
@@ -35,7 +38,7 @@ All chained commands are kind of queued up. They are combined to one single tran
 | .insertText()   | Insert a string of text at the currently selected position. |
 | .setContent()   | Replace the whole document with new content.                |
 
-## Nodes & Marks
+### Nodes & Marks
 | Command             | Description                                            |
 | ------------------- | ------------------------------------------------------ |
 | .removeMark()       | Remove a mark in the current selection.                |
@@ -46,7 +49,7 @@ All chained commands are kind of queued up. They are combined to one single tran
 | .setBlockType()     | Replace a given range with a node.                     |
 | .updateMark()       | Update a mark with new attributes.                     |
 
-## Lists
+### Lists
 | Command             | Description                                            |
 | ------------------- | ------------------------------------------------------ |
 | .liftListItem()     | Lift the list item into a wrapping list.               |
@@ -54,7 +57,7 @@ All chained commands are kind of queued up. They are combined to one single tran
 | .splitListItem()    | Splits a textblock of a list item into two list items. |
 | .toggleList()       | Toggle between different list styles.                  |
 
-## Selection
+### Selection
 | Command            | Description                             |
 | ------------------ | --------------------------------------- |
 | .blur()            | Blurs the editor.                       |
@@ -63,5 +66,5 @@ All chained commands are kind of queued up. They are combined to one single tran
 | .scrollIntoView()  | Scroll the selection into view.         |
 | .selectAll()       | Select the whole document.              |
 
-## Extensions
+### Extensions
 All extension can add additional commands (and most do), check out the specific [documentation for the provided extensions](/api/extensions) to learn more about that. Of course, you can [add your custom extensions](/guide/custom-extensions) with custom commands aswell.

From 546f0e750d2a7fc333e493082c909168354c9799 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 17:24:09 +0200
Subject: [PATCH 008/116] clean zp

---
 docs/src/docPages/examples/basic.md | 1 -
 1 file changed, 1 deletion(-)

diff --git a/docs/src/docPages/examples/basic.md b/docs/src/docPages/examples/basic.md
index 14651225..20364f82 100644
--- a/docs/src/docPages/examples/basic.md
+++ b/docs/src/docPages/examples/basic.md
@@ -1,4 +1,3 @@
 # Basic
 
 
-

From 3774d95b2193a9b5ea54c9cd188219392e3dae7c Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 17:24:19 +0200
Subject: [PATCH 009/116] rewrite yarn.lock

---
 yarn.lock | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/yarn.lock b/yarn.lock
index 92429267..838a456b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2388,9 +2388,9 @@
   integrity sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==
 
 "@types/react@^16.8.12":
-  version "16.9.49"
-  resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.49.tgz#09db021cf8089aba0cdb12a49f8021a69cce4872"
-  integrity sha512-DtLFjSj0OYAdVLBbyjhuV9CdGVHCkHn2R+xr3XkBvK2rS1Y1tkc14XSGjYgm5Fjjr90AxH9tiSzc1pCFMGO06g==
+  version "16.9.50"
+  resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.50.tgz#cb5f2c22d42de33ca1f5efc6a0959feb784a3a2d"
+  integrity sha512-kPx5YsNnKDJejTk1P+lqThwxN2PczrocwsvqXnjvVvKpFescoY62ZiM3TV7dH1T8lFhlHZF+PE5xUyimUwqEGA==
   dependencies:
     "@types/prop-types" "*"
     csstype "^3.0.2"
@@ -3920,9 +3920,9 @@ caniuse-api@^3.0.0:
     lodash.uniq "^4.5.0"
 
 caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001135:
-  version "1.0.30001141"
-  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001141.tgz#214a196d81aa938b268fb0cb6d8fab23fdf14378"
-  integrity sha512-EHfInJHoQTmlMdVZrEc5gmwPc0zyN/hVufmGHPbVNQwlk7tJfCmQ2ysRZMY2MeleBivALUTyyxXnQjK18XrVpA==
+  version "1.0.30001142"
+  resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001142.tgz#a8518fdb5fee03ad95ac9f32a9a1e5999469c250"
+  integrity sha512-pDPpn9ankEpBFZXyCv2I4lh1v/ju+bqb78QfKf+w9XgDAFWBwSYPswXqprRdrgQWK0wQnpIbfwRjNHO1HWqvoQ==
 
 case-sensitive-paths-webpack-plugin@^2.2.0:
   version "2.3.0"
@@ -4771,9 +4771,9 @@ css-what@2.1:
   integrity sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==
 
 css-what@^3.2.1:
-  version "3.4.0"
-  resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.0.tgz#f8d042a1ebb31a8251e64d2a0f0ec3fee9a05267"
-  integrity sha512-HA4iK1F5BEjbfSAguPk03XboiTvzS0tsqkoSJhkZVf52TgigRpIRGXtvSGRVgHcr1ln1Ubqx2flxKFwtY3kX9A==
+  version "3.4.1"
+  resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.1.tgz#81cb70b609e4b1351b1e54cbc90fd9c54af86e2e"
+  integrity sha512-wHOppVDKl4vTAOWzJt5Ek37Sgd9qq1Bmj/T1OjvicWbU5W7ru7Pqbn0Jdqii3Drx/h+dixHKXNhZYx7blthL7g==
 
 cssesc@^2.0.0:
   version "2.0.0"

From 548e14854938ecafaffe38cc73d28638c6ee8c13 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Fri, 2 Oct 2020 21:11:01 +0200
Subject: [PATCH 010/116] add content

---
 docs/src/docPages/guide/custom-extensions.md | 2 +-
 docs/src/docPages/guide/custom-styling.md    | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/docs/src/docPages/guide/custom-extensions.md b/docs/src/docPages/guide/custom-extensions.md
index 76c3c088..0e6d430a 100644
--- a/docs/src/docPages/guide/custom-extensions.md
+++ b/docs/src/docPages/guide/custom-extensions.md
@@ -3,7 +3,7 @@
 ## Table of Contents
 
 ## Introduction
-Let’s extend tiptap with a custom extension!
+One of the strength of tiptap is it’s extendability. You don’t depend on the provided extensions, it’s intended to extend the editor to your liking. With custom extensions you can add new content types and new functionalities, on top of what already exists or on top of that.
 
 ## Option 1: Change defaults
 
diff --git a/docs/src/docPages/guide/custom-styling.md b/docs/src/docPages/guide/custom-styling.md
index b1605244..b3c53c02 100644
--- a/docs/src/docPages/guide/custom-styling.md
+++ b/docs/src/docPages/guide/custom-styling.md
@@ -10,7 +10,7 @@ The whole editor is rendered inside of a container with the class `.ProseMirror`
 
 ```css
 /* Scoped to the editor */
-.ProseMirror p {
+.ProseMirror p {
   margin: 1em 0;
 }
 ```
@@ -19,7 +19,7 @@ If you’re rendering the stored content somewhere, there won’t be a `.ProseMi
 
 ```css
 /* Global styling */
-p {
+p {
   margin: 1em 0;
 }
 ```
@@ -29,7 +29,6 @@ p {
 Most extensions have a `class` option, which you can use to add a custom CSS class to the HTML tag.
 
 ```js
-/* Add custom classes */
 new Editor({
   extensions: [
     Document(),
@@ -55,7 +54,6 @@ The rendered HTML will look like that:
 You can even customize the markup for every extension. This will make a custom bold extension that doesn’t render a `` tag, but a `` tag:
 
 ```js
-/* Customizing the markup */
 import Bold from '@tiptap/extension-bold'
 
 const CustomBold = Bold

From b6a06c071fb2057c9767f25574961501c56b0673 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= 
Date: Fri, 2 Oct 2020 21:57:46 +0200
Subject: [PATCH 011/116] refactoring

---
 packages/core/src/Editor.ts | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts
index 87e50e39..f935946e 100644
--- a/packages/core/src/Editor.ts
+++ b/packages/core/src/Editor.ts
@@ -122,14 +122,7 @@ export class Editor extends EventEmitter {
     this.registerCommands(coreCommands)
     this.injectCSS()
 
-    // TODO: The autoFocus option has no impact
-    // Doesn’t work
-    this.proxy.focus(this.options.autoFocus)
-    // Does work
-    // window.setTimeout(() => {
-    //   console.log(this.options.autoFocus)
-    //   this.proxy.focus(this.options.autoFocus)
-    // }, 100)
+    window.setTimeout(() => this.proxy.focus(this.options.autoFocus), 0)
   }
 
   /**

From 6cec81d79142238ed171af6cdcd491e07869a1e6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 5 Oct 2020 06:20:48 +0000
Subject: [PATCH 012/116] Bump actions/upload-artifact from v2.1.4 to v2.2.0

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from v2.1.4 to v2.2.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2.1.4...27bce4eee761b5bc643f46a8dfb41b430c8d05f6)

Signed-off-by: dependabot[bot] 
---
 .github/workflows/main.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ddf8fb4e..d6e81503 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -87,14 +87,14 @@ jobs:
         browser: chrome
 
     - name: Export screenshots (on failure only)
-      uses: actions/upload-artifact@v2.1.4
+      uses: actions/upload-artifact@v2.2.0
       if: failure()
       with:
         name: cypress-screenshots
         path: tests/cypress/screenshots
 
     - name: Export screen recordings (on failure only)
-      uses: actions/upload-artifact@v2.1.4
+      uses: actions/upload-artifact@v2.2.0
       if: failure()
       with:
         name: cypress-videos

From 4cc47f16d3389f9d3aa8f3bb0bdf33605b8bfaf6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 5 Oct 2020 06:20:52 +0000
Subject: [PATCH 013/116] Bump actions/setup-node from v2.1.1 to v2.1.2

Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.1 to v2.1.2.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.1...c6fd00ceb9747fb23ffdf72987450a2664414867)

Signed-off-by: dependabot[bot] 
---
 .github/workflows/main.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ddf8fb4e..cbf3a7df 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -27,7 +27,7 @@ jobs:
     - uses: actions/checkout@v2.3.3
 
     - name: Use Node.js ${{ matrix.node-version }}
-      uses: actions/setup-node@v2.1.1
+      uses: actions/setup-node@v2.1.2
       with:
         node-version: ${{ matrix.node-version }}
 
@@ -72,7 +72,7 @@ jobs:
     - uses: actions/checkout@v2.3.3
 
     - name: Use Node.js ${{ matrix.node-version }}
-      uses: actions/setup-node@v2.1.1
+      uses: actions/setup-node@v2.1.2
       with:
         node-version: ${{ matrix.node-version }}
 
@@ -125,7 +125,7 @@ jobs:
     - uses: actions/checkout@v2.3.3
 
     - name: Use Node.js ${{ matrix.node-version }}
-      uses: actions/setup-node@v2.1.1
+      uses: actions/setup-node@v2.1.2
       with:
         node-version: ${{ matrix.node-version }}
 

From 3b17ab50562d281341405e7dc340650582a14816 Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Mon, 5 Oct 2020 10:00:48 +0200
Subject: [PATCH 014/116] add retention days config to upload artifacts action

---
 .github/workflows/clean-up.yml | 20 --------------------
 .github/workflows/main.yml     |  2 ++
 2 files changed, 2 insertions(+), 20 deletions(-)
 delete mode 100644 .github/workflows/clean-up.yml

diff --git a/.github/workflows/clean-up.yml b/.github/workflows/clean-up.yml
deleted file mode 100644
index e325c934..00000000
--- a/.github/workflows/clean-up.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# GitHub Action to remove old artifacts
-# Documentation: https://github.com/c-hive/gha-remove-artifacts
-
-name: clean-up
-
-on:
-  schedule:
-    # Every day at 1am
-    - cron: '0 1 * * *'
-
-jobs:
-  remove-old-artifacts:
-    runs-on: ubuntu-latest
-    timeout-minutes: 10
-
-    steps:
-    - name: Remove old artifacts
-      uses: c-hive/gha-remove-artifacts@v1
-      with:
-        age: '1 week'
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 04402e70..e827dd9d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -92,6 +92,7 @@ jobs:
       with:
         name: cypress-screenshots
         path: tests/cypress/screenshots
+        retention-days: 7
 
     - name: Export screen recordings (on failure only)
       uses: actions/upload-artifact@v2.2.0
@@ -99,6 +100,7 @@ jobs:
       with:
         name: cypress-videos
         path: tests/cypress/videos
+        retention-days: 7
 
     - name: Send Slack notifications
       uses: act10ns/slack@v1

From a52f95a7705329950af164ae65b59b9ed2cc572d Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Mon, 5 Oct 2020 10:01:43 +0200
Subject: [PATCH 015/116] add clean up script again (remove later)

---
 .github/workflows/clean-up.yml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 .github/workflows/clean-up.yml

diff --git a/.github/workflows/clean-up.yml b/.github/workflows/clean-up.yml
new file mode 100644
index 00000000..9787d5e6
--- /dev/null
+++ b/.github/workflows/clean-up.yml
@@ -0,0 +1,20 @@
+# GitHub Action to remove old artifacts
+# Documentation: https://github.com/c-hive/gha-remove-artifacts
+
+name: clean-up
+
+on:
+  schedule:
+    # Every day at 1am
+    - cron: '0 1 * * *'
+
+jobs:
+  remove-old-artifacts:
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+
+    steps:
+    - name: Remove old artifacts
+      uses: c-hive/gha-remove-artifacts@v1
+      with:
+        age: '1 hour'

From 2d82e4e1a7896e2e03f06cf1027e2027a3268f2d Mon Sep 17 00:00:00 2001
From: Hans Pagel 
Date: Mon, 5 Oct 2020 14:56:45 +0200
Subject: [PATCH 016/116] add mooore content

---
 docs/src/demos/Examples/Basic/index.vue       | 16 ++++++-------
 .../demos/Examples/ExportHtmlOrJson/index.vue | 16 ++++++-------
 docs/src/demos/Examples/Focus/index.vue       | 11 +++++----
 docs/src/demos/Examples/Links/index.vue       |  7 ++++--
 docs/src/demos/Examples/Minimalist/index.vue  | 16 ++++++-------
 docs/src/demos/Examples/ReadOnly/index.vue    |  6 ++++-
 docs/src/docPages/examples/basic.md           |  1 +
 .../examples/collaborative-editing.md         | 10 ++++++--
 docs/src/docPages/examples/focus.md           |  2 +-
 docs/src/docPages/examples/minimalist.md      |  2 +-
 .../docPages/guide/collaborative-editing.md   | 24 +++++++++++++++++++
 docs/src/layouts/App/base.scss                |  3 ++-
 docs/src/links.yaml                           |  6 ++---
 13 files changed, 80 insertions(+), 40 deletions(-)
 create mode 100644 docs/src/docPages/guide/collaborative-editing.md

diff --git a/docs/src/demos/Examples/Basic/index.vue b/docs/src/demos/Examples/Basic/index.vue
index 5fe494f4..38fabd2a 100644
--- a/docs/src/demos/Examples/Basic/index.vue
+++ b/docs/src/demos/Examples/Basic/index.vue
@@ -1,6 +1,5 @@
 
 
 
diff --git a/docs/src/docPages/api/extensions/text-align.md b/docs/src/docPages/api/extensions/text-align.md
new file mode 100644
index 00000000..fdb3680a
--- /dev/null
+++ b/docs/src/docPages/api/extensions/text-align.md
@@ -0,0 +1,16 @@
+# Text Align
+
+## Installation
+```bash
+# With npm
+npm install @tiptap/extension-text-align
+
+# Or: With Yarn
+yarn add @tiptap/extension-text-align
+```
+
+## Source code
+[packages/extension-text-align/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-text-align/)
+
+## Usage
+
diff --git a/docs/src/links.yaml b/docs/src/links.yaml
index 25ca4886..ce4a8bc9 100644
--- a/docs/src/links.yaml
+++ b/docs/src/links.yaml
@@ -161,6 +161,8 @@
         #   draft: true
         - title: Text
           link: /api/extensions/text
+        - title: Text Align
+          link: /api/extensions/text-align
         # - title: TodoItem
         #   link: /api/extensions/todo-item
         #   draft: true
diff --git a/packages/extension-paragraph/index.ts b/packages/extension-paragraph/index.ts
index 51a24d50..59706d64 100644
--- a/packages/extension-paragraph/index.ts
+++ b/packages/extension-paragraph/index.ts
@@ -8,36 +8,6 @@ const Paragraph = createNode({
 
   content: 'inline*',
 
-  // addGlobalAttributes() {
-  //   return [
-  //     {
-  //       types: ['paragraph'],
-  //       attributes: {
-  //         align: {
-  //           default: 'right',
-  //           renderHTML: attributes => ({
-  //             class: 'foo',
-  //             style: `text-align: ${attributes.align}`,
-  //           }),
-  //         },
-  //       },
-  //     },
-  //   ]
-  // },
-
-  // addAttributes() {
-  //   return {
-  //     id: {
-  //       default: '123',
-  //       rendered: true,
-  //       renderHTML: attributes => ({
-  //         class: 'bar',
-  //         style: 'color: red',
-  //       }),
-  //     },
-  //   }
-  // },
-
   parseHTML() {
     return [
       { tag: 'p' },
diff --git a/packages/extension-text-align/index.ts b/packages/extension-text-align/index.ts
new file mode 100644
index 00000000..c99bf49a
--- /dev/null
+++ b/packages/extension-text-align/index.ts
@@ -0,0 +1,27 @@
+import { createExtension } from '@tiptap/core'
+
+const TextAlign = createExtension({
+  addGlobalAttributes() {
+    return [
+      {
+        types: ['paragraph'],
+        attributes: {
+          align: {
+            default: 'left',
+            renderHTML: attributes => ({
+              style: `text-align: ${attributes.align}`,
+            }),
+          },
+        },
+      },
+    ]
+  },
+})
+
+export default TextAlign
+
+declare module '@tiptap/core/src/Editor' {
+  interface AllExtensions {
+    TextAlign: typeof TextAlign,
+  }
+}
diff --git a/packages/extension-text-align/package.json b/packages/extension-text-align/package.json
new file mode 100644
index 00000000..2914b5c4
--- /dev/null
+++ b/packages/extension-text-align/package.json
@@ -0,0 +1,17 @@
+{
+  "name": "@tiptap/extension-text-align",
+  "version": "1.0.0",
+  "source": "index.ts",
+  "main": "dist/tiptap-extension-text-align.js",
+  "umd:main": "dist/tiptap-extension-text-align.umd.js",
+  "module": "dist/tiptap-extension-text-align.mjs",
+  "unpkg": "dist/tiptap-extension-text-align.js",
+  "jsdelivr": "dist/tiptap-extension-text-align.js",
+  "files": [
+    "src",
+    "dist"
+  ],
+  "peerDependencies": {
+    "@tiptap/core": "2.x"
+  }
+}

From 9f908b2cbf91bd47d98c15bcd1fe80caa06bcdf1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= 
Date: Fri, 23 Oct 2020 17:19:12 +0200
Subject: [PATCH 091/116] add setNodeAttributes command

---
 docs/src/demos/Extensions/TextAlign/index.vue | 13 +++++----
 packages/core/src/extensions/index.ts         |  1 +
 .../core/src/extensions/setNodeAttributes.ts  | 27 +++++++++++++++++++
 packages/extension-text-align/index.ts        | 14 +++++++---
 4 files changed, 47 insertions(+), 8 deletions(-)
 create mode 100644 packages/core/src/extensions/setNodeAttributes.ts

diff --git a/docs/src/demos/Extensions/TextAlign/index.vue b/docs/src/demos/Extensions/TextAlign/index.vue
index 5c204f49..615eed4b 100644
--- a/docs/src/demos/Extensions/TextAlign/index.vue
+++ b/docs/src/demos/Extensions/TextAlign/index.vue
@@ -1,12 +1,12 @@