Replies: 10 comments 17 replies
-
I also temporarily pushed the changes into |
Beta Was this translation helpful? Give feedback.
-
Thanks! I'll take a look. |
Beta Was this translation helpful? Give feedback.
-
The problem was that
I'm pushing the fix to the branch. |
Beta Was this translation helpful? Give feedback.
-
I was thinking about
|
Beta Was this translation helpful? Give feedback.
-
@MikeAliG Let me know when you take a break so I can work on this in my free time |
Beta Was this translation helpful? Give feedback.
-
Hello! I hope you are well. Thank you very much for your wait and sorry if I took a lot of time to process the code, but please feel free to change/work any part that I'm working on, I am totally open to that and in fact I would thank you a lot as well. As for the new API, I've been trying to understand the underlying issues (if they rise) but I just pushed a small commit about the new design of
import React, { useMemo, useState } from "react";
import { createEditor, Node } from "slate";
import { withHistory } from "slate-history";
import { Slate, withReact } from "slate-react";
import {
ParagraphPlugin,
BoldPlugin,
EditablePlugins,
ItalicPlugin,
UnderlinePlugin,
pipe,
} from "@udecode/slate-plugins";
import { useSlatePlugins } from "@udecode/slate-plugins-components";
export const Editor = () => {
const { editor, editorValue, plugins, setEditorValue } = useSlatePlugins({
plugins: [
ParagraphPlugin(),
BoldPlugin(),
ItalicPlugin(),
UnderlinePlugin(),
],
withPlugins: [withReact, withHistory],
initialValue: [
{
type: options.p.type,
children: [
{
text: "This text is bold, italic and underlined.",
[options.bold.type]: true,
[options.italic.type]: true,
[options.underline.type]: true,
},
],
},
],
});
return (
<Slate
editor={editor}
value={editorValue}
onChange={(newval) => setEditorValue(newval as SlateDocument)}
>
<EditablePlugins plugins={plugins} placeholder="Enter some text..." />
</Slate>
);
};
So right now, I am working to make all the basic elements renderless to be able to test these theories and do some benchmarking to make sure that nothing is being lost and everything is behaving perfectly but as it might take some time, please let me know if you want me to work on some other parts or if you want to change anything in any part, I will gladly change it. As always thank you for your attention, and please feel free to not only let me know about your ideas but also please change/work on any part, it will help me as well. Many thanks, |
Beta Was this translation helpful? Give feedback.
-
I am currently transferring the components
export const ParagraphPlugin = (
// These options would be required because they should receive the component:
options: ParagraphPluginOptions
): SlatePlugin => ({
renderElement: renderElementParagraph(options),
deserialize: deserializeParagraph(options),
onKeyDown: getOnHotkeyToggleNodeTypeDefault({
key: 'p',
defaultOptions: DEFAULTS_PARAGRAPH,
options,
}),
});
where options receive: export interface RenderNodeOptions
extends RootProps<RenderNodePropsOptions>,
HotkeyOptions {
/**
* Type of the node.
*/
type?: string;
/**
* React component of the node.
*/
// In this approach this option would be required in here.
component: React.ElementType;
}
Both are possible with their own advantages and disadvantages but please let me know your ideas on this, which one would you prefer? |
Beta Was this translation helpful? Give feedback.
-
Thank you for the follow ups and PR. So, now, I think we can move on to
I have some ideas but please challenge them: Now that we have a global store, we can share the same store with the end user so that they can even modify it to their needs and overwrite the store values if they wish to do so. In which case, we don't need the /**
* Enables support for paragraphs.
*/
export const ParagraphPlugin = (): SlatePlugin => {
const {
main: {
components: { p },
},
} = useSlatePluginsStore();
return({
renderElement: renderElementParagraph(p),
deserialize: deserializeParagraph(p),
onKeyDown: getOnHotkeyToggleNodeTypeDefault({
key: 'p',
defaultOptions: p.DEFAULTS_PARAGRAPH,
}),
})}; So now, if they need to change To summarise, this approach has some Pros:
*As for the on-the-fly editors, I mean the editors which the plugins need to change on-the-fly. An example of this would be the environment we need for the interactive docs where users can play around with the editor and write code to reflect the options. Although these are fine, but please let me know if you have any thoughts on any of this. I'd like to know your thoughts. |
Beta Was this translation helpful? Give feedback.
-
@MikeAliG I'm currently working on this branch, I'll keep you updated! |
Beta Was this translation helpful? Give feedback.
-
@MikeAliG v1 alpha is released, completing all the requested features and even more! See the sandbox. I still need to write the migration guide and new docs. |
Beta Was this translation helpful? Give feedback.
-
Progress discussion #363
Hello, I hope you are well and Happy New Year. First of all, Thank you for waiting for the transition modules (
@udecode/slate-plugins-common
and@udecode/slate-plugins-test-utils
) the work was taking a toll and thankfully over the Christmas I have some time to go over the transition. As for the progress, we have had great progress specially in terms of compartmentalisation and module control and it is almost ready for the initial commit but there's a problem with the new module build and I dug down into it but to no avail. The built files in the@udecode/slate-plugins-common
and@udecode/slate-plugins-test-utils
and their types are moved in a subfolder with the package name which you can find below:This issue could be on the rollup for which I found the closest issue in here which is still open but what's interesting is the problem doesn't occur for none of the other packages and it just happens to happen for the new packages (
@udecode/slate-plugins-common
and@udecode/slate-plugins-test-utils
) which is probably something I'm missing but I checked therollup.config.js
and the config seems fine but I have no idea this issue occurs so please let me know if you have any solution to this issue.Have a great day,
Ali
Beta Was this translation helpful? Give feedback.
All reactions