Skip to content

Commit

Permalink
Merge pull request #93 from pastagang/lu/lasagne
Browse files Browse the repository at this point in the history
fix some more type issues
  • Loading branch information
TodePond authored Feb 15, 2025
2 parents cd428c2 + 660a60f commit 133c172
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/declare.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Window {
setSettingsFromDom: any;
kabel: any;
kabelsalat: any;
session: any;
}

// Pattern.prototype.p
Expand All @@ -33,4 +34,6 @@ interface Element {
close?: any;
href?: string;
click?: any;
contentWindow?: any;
innerText?: string;
}
15 changes: 4 additions & 11 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@ window.editorViews = pastamirror.editorViews;
export const session = new Session('pastagang2', {
// changed this part to what flok.cc uses
hostname: 'flok.cc',
port: '', //parseInt(port),
// port: '', //parseInt(port),
isSecure: true,
});
window.session = session;

/* session.on("change", (...args) => console.log("change", ...args));
session.on("message", (msg) => console.log("message", msg)); */
session.on('open', () => {
console.log('open');
// clearGlobalError();
});

session.on('sync', () => {
// If session is empty, create two documents
if (session.getDocuments().length === 0) {
Expand Down Expand Up @@ -101,7 +94,7 @@ let showLocalError = (docId, message) => {
if (errorEl) {
errorEl.innerText = message;
} else {
slot.insertAdjacentHTML('beforeend', `<div class="error" id="error-${docId}">${message}</div>`);
slot?.insertAdjacentHTML('beforeend', `<div class="error" id="error-${docId}">${message}</div>`);
}
};

Expand Down Expand Up @@ -187,7 +180,7 @@ addEventListener(
);

// add / remove panes
document.getElementById('add-pane-button').addEventListener('click', () => {
document.getElementById('add-pane-button')?.addEventListener('click', () => {
if (!session) return;
const documents = session.getDocuments();
if (documents.length >= 8) {
Expand All @@ -200,7 +193,7 @@ document.getElementById('add-pane-button').addEventListener('click', () => {
];
session.setActiveDocuments(newDocs);
});
document.getElementById('remove-pane-button').addEventListener('click', () => {
document.getElementById('remove-pane-button')?.addEventListener('click', () => {
if (!session) return;
const documents = session.getDocuments();
session.setActiveDocuments([...documents.map((doc) => ({ id: doc.id, target: doc.target })).slice(0, -1)]);
Expand Down

0 comments on commit 133c172

Please sign in to comment.