mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 19:59:02 +08:00
rename autoFocus to autofocus
This commit is contained in:
parent
4579a15300
commit
aa17a4313c
@ -39,7 +39,7 @@ export default {
|
||||
BulletList,
|
||||
ListItem,
|
||||
],
|
||||
autoFocus: true,
|
||||
autofocus: true,
|
||||
content: `
|
||||
<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, it’ll add <code>.has-focus</code>, even to nested nodes.
|
||||
|
@ -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). |
|
||||
|
@ -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: '<p>Hey there!</p>',
|
||||
autoFocus: true,
|
||||
autofocus: true,
|
||||
})
|
||||
```
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user