From aa17a4313ce2c6f778880b92e19af5bfad0b51c8 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Tue, 17 Nov 2020 15:47:39 +0100 Subject: [PATCH] rename autoFocus to autofocus --- docs/src/demos/Extensions/Focus/index.vue | 2 +- docs/src/docPages/api/editor.md | 2 +- docs/src/docPages/guide/configuration.md | 4 ++-- docs/src/docPages/overview/upgrade-guide.md | 10 +++++----- packages/core/src/Editor.ts | 4 ++-- packages/core/src/types.ts | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/src/demos/Extensions/Focus/index.vue b/docs/src/demos/Extensions/Focus/index.vue index fcd1730a..46b7ccba 100644 --- a/docs/src/demos/Extensions/Focus/index.vue +++ b/docs/src/demos/Extensions/Focus/index.vue @@ -39,7 +39,7 @@ export default { BulletList, ListItem, ], - autoFocus: true, + autofocus: true, content: `

The focus extension adds a class to the focused node only. That enables you to add a custom styling to just that node. By default, it’ll add .has-focus, even to nested nodes. diff --git a/docs/src/docPages/api/editor.md b/docs/src/docPages/api/editor.md index 721b9b03..26d31291 100644 --- a/docs/src/docPages/api/editor.md +++ b/docs/src/docPages/api/editor.md @@ -8,7 +8,7 @@ This class is a central building block of tiptap. It does most of the heavy lift ## Configuration | Setting | Type | Default | Description | | ------------------ | --------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `autoFocus` | `Boolean` | `false` | Focus the editor on init. | +| `autofocus` | `Boolean` | `false` | Focus the editor on init. | | `content` | `Object|String` | `null` | The editor state object used by Prosemirror. You can also pass HTML to the `content` slot. When used both, the `content` slot will be ignored. | | `editable` | `Boolean` | `true` | When set to `false` the editor is read-only. | | `editorProps` | `Object` | `{}` | A list of [Prosemirror editorProps](https://prosemirror.net/docs/ref/#view.EditorProps). | diff --git a/docs/src/docPages/guide/configuration.md b/docs/src/docPages/guide/configuration.md index 7bf12960..c999cada 100644 --- a/docs/src/docPages/guide/configuration.md +++ b/docs/src/docPages/guide/configuration.md @@ -6,7 +6,7 @@ tiptap is all about customization. There are a ton of options to configure the behavior and functionality of the editor. Most of those settings can be set before creating the Editor. Give tiptap a JSON with all the settings you would like to overwrite. ## Overwrite the default settings -See an example with `autoFocus: true` here: +See an example with `autofocus: true` here: ```js import { Editor } from '@tiptap/core' @@ -16,7 +16,7 @@ new Editor({ element: document.querySelector('.element'), extensions: defaultExtensions(), content: '

Hey there!

', - autoFocus: true, + autofocus: true, }) ``` diff --git a/docs/src/docPages/overview/upgrade-guide.md b/docs/src/docPages/overview/upgrade-guide.md index 83e6ff8b..a29d8c25 100644 --- a/docs/src/docPages/overview/upgrade-guide.md +++ b/docs/src/docPages/overview/upgrade-guide.md @@ -75,12 +75,12 @@ const CustomExtension = Node.create({ Read more about [all the nifty details building custom extensions](/guide/build-custom-extensions) in our guide. -### Renamed API methods -[We renamed a lot of commands](/api/commands), hopefully you can migrate to the new API with search & replace. Here is a list of what changed: +### Renamed settings and methods +[We renamed a lot of settings and methods](/api/editor). Hopefully you can migrate to the new API with search & replace. Here is a list of what changed: -| Old method name | New method name | -| --------------- | --------------- | -| ~~`…`~~ | `…` | +| Old name | New name | +| --------------- | ----------- | +| ~~`autoFocus`~~ | `autofocus` | ### Commands can be chained now Most commands can be combined to one call now. That’s shorter than separate function calls in most cases. Here is an example to make the selected text bold: diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index a8834078..f32e3b22 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -48,7 +48,7 @@ export class Editor extends EventEmitter { content: '', injectCSS: true, extensions: [], - autoFocus: false, + autofocus: false, editable: true, onInit: () => null, onUpdate: () => null, @@ -79,7 +79,7 @@ export class Editor extends EventEmitter { this.on('blur', this.options.onBlur) window.setTimeout(() => { - this.commands.focus(this.options.autoFocus) + this.commands.focus(this.options.autofocus) this.emit('init') }, 0) } diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 65d018a9..79639b8a 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -14,7 +14,7 @@ export interface EditorOptions { content: EditorContent, extensions: Extensions, injectCSS: boolean, - autoFocus: 'start' | 'end' | number | boolean | null, + autofocus: 'start' | 'end' | number | boolean | null, editable: boolean, onInit: () => void, onUpdate: () => void,