mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-11-14 06:17:13 +00:00
Javascript related code changes (#112)
* Add if statement for case where shortcutsGroup can be undefined * Use "===" instead of "==". Comparison prefix "==" may cause unexpected type coercion * Remove anonymous function wrapping
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
(function () {
|
||||
window.hyphaChanged = false;
|
||||
let textarea = document.querySelector('.edit-form__textarea');
|
||||
let form = document.querySelector('.edit-form');
|
||||
@@ -18,4 +17,3 @@
|
||||
});
|
||||
|
||||
window.addEventListener('beforeunload', warnBeforeClosing);
|
||||
})();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
(() => {
|
||||
const $ = document.querySelector.bind(document);
|
||||
const $$ = (...args) => Array.prototype.slice.call(document.querySelectorAll(...args));
|
||||
|
||||
@@ -263,10 +262,12 @@
|
||||
listItem.appendChild(shortcutColumn);
|
||||
}
|
||||
|
||||
if (shortcutsGroup) {
|
||||
shortcutsGroup.appendChild(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open() {
|
||||
this.prevActiveElement = document.activeElement;
|
||||
@@ -364,4 +365,3 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -44,8 +44,8 @@ function selectionWrapper(cursorPosition, prefix, postfix = null, el = editTexta
|
||||
// selection is decorated, so we just cut it
|
||||
removing = true
|
||||
result = text.substring(cursorPosition, text.length - cursorPosition)
|
||||
} else if ( (prefix == el.value.slice(start-cursorPosition, start)) &&
|
||||
(postfix == el.value.slice(end, end+cursorPosition)) ) {
|
||||
} else if ( (prefix === el.value.slice(start-cursorPosition, start)) &&
|
||||
(postfix === el.value.slice(end, end+cursorPosition)) ) {
|
||||
// selection is surrounded by decorations
|
||||
removing = true
|
||||
result = text
|
||||
|
||||
Reference in New Issue
Block a user