Skip to content
Merged
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
18 changes: 12 additions & 6 deletions django_ckeditor_5/static/django_ckeditor_5/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ function getCookie(name) {
/**
* Checks whether the element or its children match the query and returns
* an array with the matches.
*
*
* @param {!HTMLElement} element
* @param {!string} query
*
*
* @returns {array.<HTMLElement>}
*/
function resolveElementArray(element, query) {
Expand All @@ -39,9 +39,9 @@ function resolveElementArray(element, query) {
/**
* This function initializes the CKEditor inputs within an optional element and
* assigns properties necessary for the correct operation
*
*
* @param {HTMLElement} [element=document.body] - The element to search for elements
*
*
* @returns {void}
*/
function createEditors(element = document.body) {
Expand Down Expand Up @@ -81,6 +81,12 @@ function createEditors(element = document.body) {
var regex = new RegExp(match[1], match[2]);
return regex;
}
if (value.toString().startsWith('::function::-')) {
var funName = value.toString().split('-')[1]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

typo in funcName

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Suggested change
var funName = value.toString().split('-')[1]
var funcName = value.toString().split('-')[1]

// callback must be installed into this global object first
var func = window.djangoCKEditor5Functions[funcName]
return func;
}
return value;
}
);
Expand Down Expand Up @@ -126,10 +132,10 @@ function createEditors(element = document.body) {
* This function filters the list of mutations only by added elements, thus
* eliminates the occurrence of text nodes and tags where it does not make sense
* to try to use with `QuerySelectorAll()` and `matches()` functions.
*
*
* @param {MutationRecord} recordList - It is the object inside the array
* passed to the callback of a MutationObserver.
*
*
* @returns {Array} Array containing filtered nodes.
*/
function getAddedNodes(recordList) {
Expand Down
Loading