hotfix: fix build error

This commit is contained in:
Felix Roos 2023-12-27 13:28:20 +01:00
parent edfa0c65f9
commit 9b5842b20e
2 changed files with 23 additions and 21 deletions

View File

@ -1,6 +1,6 @@
const parser = new DOMParser(); const parser = typeof DOMParser !== 'undefined' ? new DOMParser() : null;
export let html = (string) => { export let html = (string) => {
return parser.parseFromString(string, 'text/html').querySelectorAll('*'); return parser?.parseFromString(string, 'text/html').querySelectorAll('*');
}; };
let parseChunk = (chunk) => { let parseChunk = (chunk) => {
if (Array.isArray(chunk)) return chunk.flat().join(''); if (Array.isArray(chunk)) return chunk.flat().join('');

View File

@ -6,26 +6,28 @@ const getDocLabel = (doc) => doc.name || doc.longname;
let ctrlDown = false; let ctrlDown = false;
// Record Control key event to trigger or block the tooltip depending on the state if (typeof window !== 'undefined') {
window.addEventListener( // Record Control key event to trigger or block the tooltip depending on the state
'keyup', window.addEventListener(
function (e) { 'keyup',
if (e.key == 'Control') { function (e) {
ctrlDown = false; if (e.key == 'Control') {
} ctrlDown = false;
}, }
true, },
); true,
);
window.addEventListener( window.addEventListener(
'keydown', 'keydown',
function (e) { function (e) {
if (e.key == 'Control') { if (e.key == 'Control') {
ctrlDown = true; ctrlDown = true;
} }
}, },
true, true,
); );
}
export const strudelTooltip = hoverTooltip( export const strudelTooltip = hoverTooltip(
(view, pos, side) => { (view, pos, side) => {