Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi-editor #668

Merged
merged 18 commits into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 25 additions & 0 deletions .changeset/core-major-eight-poems-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

"@udecode/slate-plugins-core": major
------------------------------------

- renamed:
- `useTSlate` to `useEditorState`
- `useTSlateStatic` to `useEditorRef`
- `useStoreEditor` to `useStoreEditorRef`
- removed:
- `useEditorId` in favor of `useEditorRef().id`
- `useEditorOptions` in favor of `useEditorRef().options`
- `useSlatePluginOptions` in favor of
`getSlatePluginOptions(useEditorRef(), pluginKey)`
- `useSlatePluginType` in favor of
`getSlatePluginType(useEditorRef(), pluginKey)`
- `pipeOnDOMBeforeInput` in favor of `pipeHandler`
- `pipeOnKeyDown` in favor of `pipeHandler`
- types:
- renamed:
- `SlatePluginsState` to `SlatePluginsStates`
- `State` to `SlatePluginsState`
- removed:
- `OnDOMBeforeInput` in favor of
- `OnKeyDown` in favor of `KeyboardHandler`
32 changes: 32 additions & 0 deletions .changeset/core-minor-eight-poems-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
"@udecode/slate-plugins-core": minor
---

- `useEditableProps` (used by `SlatePlugins`):
- new fields returned: all handler props from the plugins (if defined)
- new core plugins with the following fields:
- `onFocus: setEventEditorId('focus', id)`
- `onBlur: setEventEditorId('blur', id)`
- You can add your own handlers in a plugin
- `EditorStateEffect`: a new component used by `SlatePlugins` to update
the editor state.
- `setEventEditorId`: a new action. Set an editor id by event key.
- `eventEditorStore`, `useEventEditorStore`: a new store. Store where
the keys are event names and the values are editor ids.
- `useEventEditorId`: a new selector. Get the editor id by `event`
key.
- `useStoreEditorSelection`: a new selector. Get the editor selection
which is updated on editor change.
- `useStoreEditorState`: a new selector. Get editor state which is
updated on editor change. Similar to `useSlate`.
- `SlatePlugin`: the previous plugin could implement the following
handlers: `onChange`, `onDOMBeforeInput` and `onKeyDown`. The plugins
now implement all DOM handlers: clipboard, composition, focus, form,
image, keyboard, media, mouse, selection, touch, pointer, ui, wheel
animation and transition events.
- `SlatePluginsState` (store interface):
- a new field `keyChange` incremented by
`SlatePlugins` on `useSlate` update.
- a new field `selection = editor.selection` updated on `useSlate`
update.
- `pipeHandler`: a new function. Generic pipe for handlers.
5 changes: 5 additions & 0 deletions .changeset/perfect-trainers-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@udecode/slate-plugins-placeholder": patch
---

Set the cursor to `text` when hovering the placeholder
15 changes: 15 additions & 0 deletions .changeset/yellow-tips-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@udecode/slate-plugins-alignment-ui": minor
"@udecode/slate-plugins-code-block-ui": minor
"@udecode/slate-plugins-dnd": minor
"@udecode/slate-plugins-image-ui": minor
"@udecode/slate-plugins-link-ui": minor
"@udecode/slate-plugins-list-ui": minor
"@udecode/slate-plugins-media-embed-ui": minor
"@udecode/slate-plugins-mention-ui": minor
"@udecode/slate-plugins-table-ui": minor
"@udecode/slate-plugins-toolbar": minor
---

The components/hooks can now be outside `SlatePlugins` and need the
editor to be focused once to be functional.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
alwaysTryTypes: true,
},
},
typescript: {},
},
react: { version: 'detect' },
},
Expand Down Expand Up @@ -71,7 +72,10 @@ module.exports = {
'import/no-dynamic-require': 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-named-as-default-member': 'off',
'import/no-unresolved': 'error',
'import/no-unresolved': [
'error',
{ ignore: ['^@theme', '^@docusaurus', '^@generated'] },
],
'import/prefer-default-export': 'off', // Allow single Named-export
'import/order': ['off', { 'newlines-between': 'always' }],
'simple-import-sort/imports': [
Expand Down
6 changes: 1 addition & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ new logic works, and why you decided to solve it the way you did.
- [x] The tests pass with `yarn test`.
- [x] The linter passes with `yarn lint`. (Fix errors with `yarn lint
--fix`.)
- [x] The relevant examples still work: (Run examples with `yarn
storybook`.)
- [ ] You've
[added a changeset](https://github.com/atlassian/changesets/blob/main/docs/adding-a-changeset.md)
if changing functionality. (Add one with `yarn changeset add`.)
- [x] The relevant examples still work: (Run examples with `yarn docs`.)

<!--

Expand Down
69 changes: 0 additions & 69 deletions .storybook/main.js

This file was deleted.

13 changes: 0 additions & 13 deletions .storybook/manager.js

This file was deleted.

20 changes: 0 additions & 20 deletions .storybook/preview.js

This file was deleted.

10 changes: 0 additions & 10 deletions .storybook/tsconfig.json

This file was deleted.

Loading