mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-26 09:23:50 +00:00
A bundled plugin that replaces the work-view task list with a TipTap
editor for projects and the TODAY tag. Task references are read-only
chips with a checkbox; everything else is normal ProseMirror content
(paragraphs, headings, dividers) plus a simple slash menu for inserts.
- Iframe plugin scaffolded under packages/plugin-dev/document-mode with
esbuild bundling. The editor.js bundle is inlined into index.html
because the blob-URL iframe can't resolve relative scripts.
- background.ts registers a work-context header button with
showFor: ['PROJECT', 'TODAY']; click calls showInWorkContext().
- editor.ts: TipTap (core + StarterKit + Placeholder) with a custom
taskRef atom node-view (checkbox + title from getTasks() cache).
Subscribes to WORK_CONTEXT_CHANGE for nav and ANY_TASK_UPDATE for
title/done-state refresh. Persists per-ctx ProseMirror JSON inside
the existing single plugin blob ({ docs: { [ctxId]: doc } }) with
5 s debounced save and a pagehide flush.
- Plugin auto-bundled by packages/plugin-dev/scripts/build-all.js and
registered in BUNDLED_PLUGIN_PATHS.
Out of scope for the POC (documented in the plan): inline-editable
task titles, keyed persistDataSynced API, removal of in-tree
document-mode, data migration, Electron beforeUnload hook.
39 lines
1 KiB
JavaScript
39 lines
1 KiB
JavaScript
#!/usr/bin/env node
|
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const ROOT_DIR = path.join(__dirname, '..');
|
|
const DIST_DIR = path.join(ROOT_DIR, 'dist');
|
|
const TARGET_DIR = path.join(
|
|
ROOT_DIR,
|
|
'..',
|
|
'..',
|
|
'..',
|
|
'src',
|
|
'assets',
|
|
'bundled-plugins',
|
|
'document-mode',
|
|
);
|
|
|
|
// editor.js is inlined into index.html, so it doesn't need to be deployed.
|
|
const FILES = ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'];
|
|
|
|
if (!fs.existsSync(DIST_DIR)) {
|
|
console.error('Error: dist directory not found. Run "npm run build" first.');
|
|
process.exit(1);
|
|
}
|
|
if (!fs.existsSync(TARGET_DIR)) {
|
|
fs.mkdirSync(TARGET_DIR, { recursive: true });
|
|
}
|
|
for (const file of FILES) {
|
|
const src = path.join(DIST_DIR, file);
|
|
const dest = path.join(TARGET_DIR, file);
|
|
if (fs.existsSync(src)) {
|
|
fs.copyFileSync(src, dest);
|
|
console.log(`✓ Copied ${file}`);
|
|
} else {
|
|
console.warn(`⚠ ${file} not found in dist`);
|
|
}
|
|
}
|
|
console.log(`\n✅ Deployed to ${TARGET_DIR}`);
|