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

Add editable preview mode to Markdown editor #669

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #664

Add editable preview mode to the Markdown editor.

  • New Command: Add editablePreview command in core/src/commands/preview.tsx to allow editing in preview mode.
  • TextArea Component: Update core/src/components/TextArea/index.tsx to support rendering an editable preview mode.
  • Editor State Management: Update core/src/Editor.tsx to manage the state and rendering of the editable preview mode.
  • Context Management: Update core/src/Context.tsx to include support for editable preview mode in the context and state management.

Related to uiwjs#664

Add editable preview mode to the Markdown editor.

* **New Command**: Add `editablePreview` command in `core/src/commands/preview.tsx` to allow editing in preview mode.
* **TextArea Component**: Update `core/src/components/TextArea/index.tsx` to support rendering an editable preview mode.
* **Editor State Management**: Update `core/src/Editor.tsx` to manage the state and rendering of the editable preview mode.
* **Context Management**: Update `core/src/Context.tsx` to include support for editable preview mode in the context and state management.
Copy link

vercel bot commented Nov 1, 2024

@vishwamartur is attempting to deploy a commit to the kenny wong's projects Team on Vercel.

A member of the Team first needs to authorize it.

@@ -91,3 +91,32 @@ export const codeLive: ICommand = {
}
},
};

export const editablePreview: ICommand = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export * from './commands';
export * from './commands/group';
export * from './utils/markdownUtils';
export * from './utils/InsertTextAtPosition';

export { editablePreview } from './commands/preview';

@vishwamartur It is necessary to export editablePreview in the entry point.

Comment on lines +101 to +108
icon: (
<svg width="12" height="12" viewBox="0 0 520 520">
<polygon fill="currentColor" points="0 71.293 0 122 179 122 179 397 0 397 0 449.707 232 449.413 232 71.293" />
<polygon
fill="currentColor"
points="289 71.293 520 71.293 520 122 341 123 341 396 520 396 520 449.707 289 449.413"
/>
</svg>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwamartur Do you need me to make a default icon for you?

<Textarea prefixCls={prefixCls} {...otherProps} style={textStyle} />
) : (
<Textarea prefixCls={prefixCls} {...otherProps} style={textStyle} readOnly />
)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vishwamartur Can this code be optimized to the following example?

<Textarea prefixCls={prefixCls} {...otherProps} style={textStyle} readOnly={preview != 'editablePreview'} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants