-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the CKEditor overlays into the page overlay container
See https://www.woltlab.com/community/thread/300815-ckeditor-link-menu-non-functional-in-ckeditor-instances-in-a-dialog/ See ckeditor/ckeditor#14747
- Loading branch information
Showing
6 changed files
with
110 additions
and
2 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,50 @@ | ||
/** | ||
* Moves CKEditor’s overlay elements into the page overlay container. This | ||
* preserves their functionality when the editor appears within a native | ||
* `<dialog>` element. | ||
* | ||
* See https://github.com/ckeditor/ckeditor5/issues/14747 | ||
* | ||
* @author Alexander Ebert | ||
* @copyright 2001-2023 WoltLab GmbH | ||
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | ||
* @since 6.0 | ||
* @woltlabExcludeBundle tiny | ||
*/ | ||
|
||
import { getPageOverlayContainer } from "../../Helper/PageOverlay"; | ||
|
||
const targetClassNames = ["ck-body-wrapper", "ck-inspector-wrapper", "ck-inspector-portal"]; | ||
|
||
function setupWatcher(): void { | ||
const observer = new MutationObserver((mutations) => { | ||
for (const mutation of mutations) { | ||
for (const node of mutation.addedNodes) { | ||
if (!(node instanceof HTMLElement)) { | ||
continue; | ||
} | ||
|
||
for (const className of targetClassNames) { | ||
if (node.classList.contains(className)) { | ||
getPageOverlayContainer().append(node); | ||
|
||
continue; | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
observer.observe(document.body, { | ||
childList: true, | ||
}); | ||
} | ||
|
||
let hasWatcher = false; | ||
export function setup(): void { | ||
if (hasWatcher) { | ||
return; | ||
} | ||
|
||
hasWatcher = true; | ||
setupWatcher(); | ||
} |
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
3 changes: 2 additions & 1 deletion
3
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Layer.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.