diff --git a/package-lock.json b/package-lock.json index 96d2db5..cb7acb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,20 @@ "version": "0.0.1", "license": "ISC", "dependencies": { + "@editorjs/editorjs": "^2.30.7", "@lit/localize": "^0.12.2", "@shoelace-style/shoelace": "^2.18.0", "@thepassle/app-tools": "^0.9.12", "axios": "^1.7.7", "cors": "^2.8.5", "express": "^4.21.1", + "lazy.js": "^0.5.1", "lit": "^3.2.1", "nostr-tools": "^2.10.1", + "prosemirror-markdown": "^1.13.1", + "prosemirror-model": "^1.24.1", + "prosemirror-state": "^1.4.3", + "prosemirror-view": "^1.37.1", "urlpattern-polyfill": "^10.0.0", "workbox-build": "^7.3.0", "workbox-core": "^7.3.0", @@ -1505,6 +1511,11 @@ "node": ">=14" } }, + "node_modules/@editorjs/editorjs": { + "version": "2.30.7", + "resolved": "https://registry.npmjs.org/@editorjs/editorjs/-/editorjs-2.30.7.tgz", + "integrity": "sha512-FfdeUqrgcKWC+Cy2GW6Dxup6s2TaRKokR4FL+HKXshu6h9Y//rrx4SQkURgkZOCSbV77t9btbmAXdFXWGB+diw==" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.21.5", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", @@ -2464,6 +2475,25 @@ "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "license": "MIT" }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==" + }, "node_modules/@types/prop-types": { "version": "15.7.13", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", @@ -2558,6 +2588,11 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "node_modules/array-buffer-byte-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", @@ -3203,6 +3238,17 @@ "node": ">= 0.8" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/es-abstract": { "version": "1.23.3", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", @@ -4302,6 +4348,11 @@ "node": ">=0.10.0" } }, + "node_modules/lazy.js": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.5.1.tgz", + "integrity": "sha512-p9v24vaKrzS2mEx3yuzva/3M6I3+HwvXd0pB1Xf/IvsFIMdhQgmym7JBO0e7c0OZmKTo07sCuiCIm6jazSWFNw==" + }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -4311,6 +4362,14 @@ "node": ">=6" } }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/lit": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/lit/-/lit-3.2.1.tgz", @@ -4378,6 +4437,27 @@ "sourcemap-codec": "^1.4.8" } }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -4580,6 +4660,11 @@ "wrappy": "1" } }, + "node_modules/orderedmap": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/orderedmap/-/orderedmap-2.1.1.tgz", + "integrity": "sha512-TvAWxi0nDe1j/rtMcWcIj94+Ffe6n7zhow33h40SKxmsmozs6dz/e+EajymfoFcHd7sxNn8yHM8839uixMOV6g==" + }, "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", @@ -4677,6 +4762,52 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/prosemirror-markdown": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/prosemirror-markdown/-/prosemirror-markdown-1.13.1.tgz", + "integrity": "sha512-Sl+oMfMtAjWtlcZoj/5L/Q39MpEnVZ840Xo330WJWUvgyhNmLBLN7MsHn07s53nG/KImevWHSE6fEj4q/GihHw==", + "dependencies": { + "@types/markdown-it": "^14.0.0", + "markdown-it": "^14.0.0", + "prosemirror-model": "^1.20.0" + } + }, + "node_modules/prosemirror-model": { + "version": "1.24.1", + "resolved": "https://registry.npmjs.org/prosemirror-model/-/prosemirror-model-1.24.1.tgz", + "integrity": "sha512-YM053N+vTThzlWJ/AtPtF1j0ebO36nvbmDy4U7qA2XQB8JVaQp1FmB9Jhrps8s+z+uxhhVTny4m20ptUvhk0Mg==", + "dependencies": { + "orderedmap": "^2.0.0" + } + }, + "node_modules/prosemirror-state": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/prosemirror-state/-/prosemirror-state-1.4.3.tgz", + "integrity": "sha512-goFKORVbvPuAQaXhpbemJFRKJ2aixr+AZMGiquiqKxaucC6hlpHNZHWgz5R7dS4roHiwq9vDctE//CZ++o0W1Q==", + "dependencies": { + "prosemirror-model": "^1.0.0", + "prosemirror-transform": "^1.0.0", + "prosemirror-view": "^1.27.0" + } + }, + "node_modules/prosemirror-transform": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/prosemirror-transform/-/prosemirror-transform-1.10.2.tgz", + "integrity": "sha512-2iUq0wv2iRoJO/zj5mv8uDUriOHWzXRnOTVgCzSXnktS/2iQRa3UUQwVlkBlYZFtygw6Nh1+X4mGqoYBINn5KQ==", + "dependencies": { + "prosemirror-model": "^1.21.0" + } + }, + "node_modules/prosemirror-view": { + "version": "1.37.1", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.37.1.tgz", + "integrity": "sha512-MEAnjOdXU1InxEmhjgmEzQAikaS6lF3hD64MveTPpjOGNTl87iRLA1HupC/DEV6YuK7m4Q9DHFNTjwIVtqz5NA==", + "dependencies": { + "prosemirror-model": "^1.20.0", + "prosemirror-state": "^1.0.0", + "prosemirror-transform": "^1.1.0" + } + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -4703,6 +4834,14 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "engines": { + "node": ">=6" + } + }, "node_modules/qr-creator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/qr-creator/-/qr-creator-1.0.0.tgz", @@ -5534,6 +5673,11 @@ "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index 97d23e6..46ab7e8 100644 --- a/package.json +++ b/package.json @@ -15,14 +15,20 @@ "author": "", "license": "ISC", "dependencies": { + "@editorjs/editorjs": "^2.30.7", "@lit/localize": "^0.12.2", "@shoelace-style/shoelace": "^2.18.0", "@thepassle/app-tools": "^0.9.12", "axios": "^1.7.7", "cors": "^2.8.5", "express": "^4.21.1", + "lazy.js": "^0.5.1", "lit": "^3.2.1", "nostr-tools": "^2.10.1", + "prosemirror-markdown": "^1.13.1", + "prosemirror-model": "^1.24.1", + "prosemirror-state": "^1.4.3", + "prosemirror-view": "^1.37.1", "urlpattern-polyfill": "^10.0.0", "workbox-build": "^7.3.0", "workbox-core": "^7.3.0", diff --git a/src/components/menu-plugin.ts b/src/components/menu-plugin.ts new file mode 100644 index 0000000..e0476ad --- /dev/null +++ b/src/components/menu-plugin.ts @@ -0,0 +1,40 @@ +import { Plugin } from 'prosemirror-state'; + +export const plusButtonPlugin = new Plugin({ + view(editorView) { + const button = document.createElement('button'); + button.textContent = '+'; + button.className = 'plus-button' + + button.style.position = 'absolute'; + button.style.zIndex = '10'; + button.style.display = 'none'; // Hide initially + + editorView.dom.appendChild(button); + + button.addEventListener('click', () => { + console.log('Plus button clicked'); + // Add logic to open dropdown or execute commands + }); + + return { + update(view) { + const { $from } = view.state.selection; + + // Only show the button when the cursor is in a text block with no content + if ($from.parent.isTextblock && $from.parent.content.size === 0) { + const coords = view.coordsAtPos($from.pos); + // Position the button relative to the cursor + button.style.top = `${coords.top + window.scrollY}px`; // Added scroll offset for better positioning + button.style.left = `${coords.left + window.scrollX - 30}px`; // Added scroll offset + button.style.display = 'block'; // Make the button visible + } else { + button.style.display = 'none'; // Hide the button when not in valid position + } + }, + destroy() { + button.remove(); // Cleanup on destroy + }, + }; + }, +}); diff --git a/src/pages/app-about/app-about.ts b/src/pages/app-about/app-about.ts index 4ee9564..e825583 100644 --- a/src/pages/app-about/app-about.ts +++ b/src/pages/app-about/app-about.ts @@ -1,12 +1,9 @@ import { LitElement, html, css } from 'lit'; import { customElement } from 'lit/decorators.js'; -// You can also import styles from another file -// if you prefer to keep your CSS seperate from your component import { styles } from './about-styles'; import { styles as sharedStyles } from '../../styles/shared-styles' - import '@shoelace-style/shoelace/dist/components/card/card.js'; @customElement('app-about') @@ -16,29 +13,6 @@ export class AppAbout extends LitElement { styles, css` - #welcomeBar { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; - } - - #welcomeCard, - #infoCard { - padding: 18px; - padding-top: 0px; - } - - sl-card::part(footer) { - display: flex; - justify-content: flex-end; - } - - @media(min-width: 750px) { - sl-card { - width: 70vw; - } - } ` ] @@ -74,7 +48,8 @@ export class AppAbout extends LitElement {