-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dialogs don't work inside Shadow DOM #866
Issue: #866)
- Loading branch information
Showing
24 changed files
with
257 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*! | ||
* Jodit Editor (https://xdsoft.net/jodit/) | ||
* Released under MIT see LICENSE.txt in the project root for license information. | ||
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net | ||
*/ | ||
|
||
import type { IDialog, IDialogOptions } from 'jodit/types'; | ||
import { ViewWithToolbar } from './view-with-toolbar'; | ||
import { Dialog, Alert, Confirm, Prompt } from 'jodit/modules/dialog'; | ||
import { isString, markOwner } from 'jodit/core/helpers'; | ||
|
||
export abstract class Panel extends ViewWithToolbar { | ||
dialog(options?: IDialogOptions): IDialog { | ||
const dialog = new Dialog({ | ||
language: this.o.language, | ||
shadowRoot: this.o.shadowRoot, | ||
ownerWindow: this.o.ownerWindow, | ||
defaultTimeout: this.o.defaultTimeout, | ||
theme: this.o.theme, | ||
...options | ||
}); | ||
markOwner(this, dialog.container); | ||
return dialog.bindDestruct(this); | ||
} | ||
|
||
confirm( | ||
msg: string, | ||
title: string | ((yes: boolean) => void) | undefined, | ||
callback?: (yes: boolean) => void | false | ||
): IDialog { | ||
if (isString(title)) { | ||
title = this.i18n(title); | ||
} | ||
return Confirm.call(this.dialog(), this.i18n(msg), title, callback); | ||
} | ||
|
||
prompt( | ||
msg: string, | ||
title: string | (() => false | void) | undefined, | ||
callback: (value: string) => false | void, | ||
placeholder?: string, | ||
defaultValue?: string | ||
): IDialog { | ||
if (isString(title)) { | ||
title = this.i18n(title); | ||
} | ||
if (isString(placeholder)) { | ||
placeholder = this.i18n(placeholder); | ||
} | ||
return Prompt.call(this.dialog(), this.i18n(msg), title, callback); | ||
} | ||
|
||
alert( | ||
msg: string | HTMLElement, | ||
title?: string | (() => void | false), | ||
callback?: string | ((dialog: IDialog) => void | false), | ||
className?: string | ||
): IDialog { | ||
if (isString(msg)) { | ||
msg = this.i18n(msg); | ||
} | ||
if (isString(title)) { | ||
title = this.i18n(title); | ||
} | ||
return Alert.call(this.dialog(), msg, title, callback, className); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.