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

fix: added temporary value to pass it to text editor while the text editor is not initiated yet. #41

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/Serenity.Demo.Northwind/Modules/Note/NoteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import { Decorators, DialogButton, BaseDialog, HtmlContentEditor, HtmlNoteConten
export class NoteDialog<P = {}> extends BaseDialog<P> {

declare private textEditor: HtmlContentEditor;
declare private textValue: string;

protected renderContents(): any {
const id = this.useIdPrefix();
return (
<form id={id.Form} class="s-Form">
<textarea id={id.Text} class="required" ref={el => queueMicrotask(() =>
this.textEditor = new HtmlNoteContentEditor({ element: el }))} />
<textarea id={id.Text} class="required" ref={el => queueMicrotask(() => {
this.textEditor = new HtmlNoteContentEditor({ element: el });
this.textEditor.value = this.textValue;
})} />
</form>
);
}
Expand All @@ -35,7 +38,9 @@ export class NoteDialog<P = {}> extends BaseDialog<P> {
}

set text(value: string) {
this.textEditor.value = value;
this.textValue = value;
if (this.textEditor)
this.textEditor.value = value;
}

declare public okClick: () => void;
Expand Down