mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-11-08 19:43:39 +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;
|
window.hyphaChanged = false;
|
||||||
let textarea = document.querySelector('.edit-form__textarea');
|
let textarea = document.querySelector('.edit-form__textarea');
|
||||||
let form = document.querySelector('.edit-form');
|
let form = document.querySelector('.edit-form');
|
||||||
@@ -18,4 +17,3 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('beforeunload', warnBeforeClosing);
|
window.addEventListener('beforeunload', warnBeforeClosing);
|
||||||
})();
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
(() => {
|
|
||||||
const $ = document.querySelector.bind(document);
|
const $ = document.querySelector.bind(document);
|
||||||
const $$ = (...args) => Array.prototype.slice.call(document.querySelectorAll(...args));
|
const $$ = (...args) => Array.prototype.slice.call(document.querySelectorAll(...args));
|
||||||
|
|
||||||
@@ -263,10 +262,12 @@
|
|||||||
listItem.appendChild(shortcutColumn);
|
listItem.appendChild(shortcutColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shortcutsGroup) {
|
||||||
shortcutsGroup.appendChild(list);
|
shortcutsGroup.appendChild(list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
this.prevActiveElement = document.activeElement;
|
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
|
// selection is decorated, so we just cut it
|
||||||
removing = true
|
removing = true
|
||||||
result = text.substring(cursorPosition, text.length - cursorPosition)
|
result = text.substring(cursorPosition, text.length - cursorPosition)
|
||||||
} else if ( (prefix == el.value.slice(start-cursorPosition, start)) &&
|
} else if ( (prefix === el.value.slice(start-cursorPosition, start)) &&
|
||||||
(postfix == el.value.slice(end, end+cursorPosition)) ) {
|
(postfix === el.value.slice(end, end+cursorPosition)) ) {
|
||||||
// selection is surrounded by decorations
|
// selection is surrounded by decorations
|
||||||
removing = true
|
removing = true
|
||||||
result = text
|
result = text
|
||||||
|
|||||||
Reference in New Issue
Block a user