The editor API does not guarantee the attribute types to be preserved, numbers can be converted into strings and returned as such.
See https://www.woltlab.com/community/thread/300956-deleted-attachments-do-not-disappear-from-the-editor/
attributes: Record<string, string | number | boolean>,
): Generator<CkeElement> {
if (element.is("element", model)) {
- let isMatch = true;
- Object.entries(attributes).forEach(([key, value]) => {
+ const isMatch = Object.entries(attributes).every(([key, value]) => {
if (!element.hasAttribute(key)) {
- isMatch = false;
- } else if (element.getAttribute(key) !== value) isMatch = false;
+ return false;
+ }
+
+ return String(element.getAttribute(key)) === value.toString();
});
if (isMatch) {
}
function* findModelForRemoval(element, model, attributes) {
if (element.is("element", model)) {
- let isMatch = true;
- Object.entries(attributes).forEach(([key, value]) => {
+ const isMatch = Object.entries(attributes).every(([key, value]) => {
if (!element.hasAttribute(key)) {
- isMatch = false;
+ return false;
}
- else if (element.getAttribute(key) !== value)
- isMatch = false;
+ return String(element.getAttribute(key)) === value.toString();
});
if (isMatch) {
yield element;