rename autoFocus to autofocus

This commit is contained in:
Hans Pagel 2020-11-17 15:47:39 +01:00
parent 4579a15300
commit aa17a4313c
6 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,7 @@ export default {
BulletList, BulletList,
ListItem, ListItem,
], ],
autoFocus: true, autofocus: true,
content: ` content: `
<p> <p>
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, itll add <code>.has-focus</code>, even to nested nodes. 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, itll add <code>.has-focus</code>, even to nested nodes.

View File

@ -8,7 +8,7 @@ This class is a central building block of tiptap. It does most of the heavy lift
## Configuration ## Configuration
| Setting | Type | Default | Description | | 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. | | `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. | | `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). | | `editorProps` | `Object` | `{}` | A list of [Prosemirror editorProps](https://prosemirror.net/docs/ref/#view.EditorProps). |

View File

@ -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. 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 ## Overwrite the default settings
See an example with `autoFocus: true` here: See an example with `autofocus: true` here:
```js ```js
import { Editor } from '@tiptap/core' import { Editor } from '@tiptap/core'
@ -16,7 +16,7 @@ new Editor({
element: document.querySelector('.element'), element: document.querySelector('.element'),
extensions: defaultExtensions(), extensions: defaultExtensions(),
content: '<p>Hey there!</p>', content: '<p>Hey there!</p>',
autoFocus: true, autofocus: true,
}) })
``` ```

View File

@ -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. Read more about [all the nifty details building custom extensions](/guide/build-custom-extensions) in our guide.
### Renamed API methods ### Renamed settings and 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: [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 ### Commands can be chained now
Most commands can be combined to one call now. Thats shorter than separate function calls in most cases. Here is an example to make the selected text bold: Most commands can be combined to one call now. Thats shorter than separate function calls in most cases. Here is an example to make the selected text bold:

View File

@ -48,7 +48,7 @@ export class Editor extends EventEmitter {
content: '', content: '',
injectCSS: true, injectCSS: true,
extensions: [], extensions: [],
autoFocus: false, autofocus: false,
editable: true, editable: true,
onInit: () => null, onInit: () => null,
onUpdate: () => null, onUpdate: () => null,
@ -79,7 +79,7 @@ export class Editor extends EventEmitter {
this.on('blur', this.options.onBlur) this.on('blur', this.options.onBlur)
window.setTimeout(() => { window.setTimeout(() => {
this.commands.focus(this.options.autoFocus) this.commands.focus(this.options.autofocus)
this.emit('init') this.emit('init')
}, 0) }, 0)
} }

View File

@ -14,7 +14,7 @@ export interface EditorOptions {
content: EditorContent, content: EditorContent,
extensions: Extensions, extensions: Extensions,
injectCSS: boolean, injectCSS: boolean,
autoFocus: 'start' | 'end' | number | boolean | null, autofocus: 'start' | 'end' | number | boolean | null,
editable: boolean, editable: boolean,
onInit: () => void, onInit: () => void,
onUpdate: () => void, onUpdate: () => void,