Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Gk0Wk committed Oct 14, 2023
1 parent 2c5aaf4 commit 022274a
Show file tree
Hide file tree
Showing 21 changed files with 2,521 additions and 95 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TiddlySeq

View [demo](https://gk0wk.github.io/TiddlySeq/).

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"lint-staged": "^14.0.1",
"rimraf": "^5.0.5",
"ts-node": "^10.9.1",
"tw5-typed": "^0.3.10",
"tw5-typed": "^0.3.11",
"typescript": "^5.2.2"
},
"dependencies": {
Expand Down
28 changes: 14 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions src/drawio/edit-drawio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class DrawIOEditor {
innerHTML: value,
});
parentNode.insertBefore(node, nextSibling);
widget.domNodes.push(node);
this.xml = '';
this.unmount = () => null;
return;
Expand All @@ -111,6 +112,7 @@ class DrawIOEditor {
},
});
parentNode.insertBefore(this.iframeNode, nextSibling);
widget.domNodes.push(this.iframeNode);

// 全屏按钮
const chatButton = $tw.utils.domMaker('button', {
Expand All @@ -134,6 +136,7 @@ class DrawIOEditor {
});
chatButton.onclick = () => this.setFullscreen(true);
parentNode.insertBefore(chatButton, nextSibling);
widget.domNodes.push(chatButton);

this.xml = value;
let hasInited = false;
Expand All @@ -146,10 +149,10 @@ class DrawIOEditor {
) {
return;
}
const { event, ...payload } = $tw.utils.parseJSONSafe(
data,
() => ({}),
) as any;
const { event, ...payload } = $tw.utils.parseJSONSafe<{
event?: string;
[payloadName: string]: unknown;
}>(data, () => ({}));
switch (event) {
case 'init': {
if (hasInited) {
Expand Down Expand Up @@ -191,16 +194,17 @@ class DrawIOEditor {
break;
}
case 'openLink': {
const { href, target } = payload;
const { href, target } = payload as { href: string; target: string };
window.open(href, target);
break;
}
case 'export': {
const { message, data } = payload;
const { message, data } = payload as {
data: string;
message: Record<string, unknown>;
};
if (data && message.twEditor) {
const newXml = ($tw.utils as any).base64Decode(
data.split(',', 2)[1],
);
const newXml = $tw.utils.base64Decode(data.split(',', 2)[1]);
if (newXml === this.xml) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/drawio/plugin.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"author": "Gk0Wk",
"description": "draw.io powerful diagram editor for TiddlyWiki",
"plugin-type": "plugin",
"version": "0.0.6",
"version": "0.0.7",
"list": "readme config LICENSE"
}
2,302 changes: 2,295 additions & 7 deletions src/mindmap-elixir/mind-elixir.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/mindmap-elixir/plugin.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"author": "Gk0Wk",
"description": "A MindMap plugin TiddlyWiki5, using Elixir",
"plugin-type": "plugin",
"version": "0.0.1",
"version": "0.0.2",
"list": "readme config"
}
17 changes: 17 additions & 0 deletions src/mindmap-elixir/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,20 @@
.gk0wk-mind-elixir-container .node-menu textarea {
color: black !important;
}

.mind-elixir-toolbar.rb {
display: flex;
align-items: center;
}

.mind-elixir-toolbar.rb span#theme,
.mind-elixir-toolbar.rb span#export,
.mind-elixir-toolbar.rb span#settings {
height: 1em;
}

.mind-elixir-toolbar.rb span#theme > p,
.mind-elixir-toolbar.rb span#export > p,
.mind-elixir-toolbar.rb span#settings > p {
margin: 0 !important;
}
44 changes: 26 additions & 18 deletions src/mindmap-elixir/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ if (typeof window !== 'undefined') {
data2Xmind = require('@mind-elixir/export-xmind').data2Xmind;
// eslint-disable-next-line prefer-destructuring
data2Html = require('@mind-elixir/export-html').data2Html;
MindElixir = require('$:/plugins/Gk0Wk/mindmap-elixir/elixir.min.js');
// eslint-disable-next-line prefer-destructuring
MindElixir =
require('$:/plugins/Gk0Wk/mindmap-elixir/elixir.min.js').MindElixir;
(globalThis as any).MindElixir = MindElixir;

const { parse, stringify } = opml;
Expand Down Expand Up @@ -111,13 +113,16 @@ class ElixirWidget extends Widget {
private locale_: LocaleType = 'en';

// Other
private optionsButtonText: string = $tw.wiki.getTiddlerText(
private optionsButtonText: string = $tw.wiki.renderTiddler(
'text/html',
'$:/core/images/options-button',
)!;
private exportButtonText: string = $tw.wiki.getTiddlerText(
private exportButtonText: string = $tw.wiki.renderTiddler(
'text/html',
'$:/core/images/export-button',
)!;
private themeButtonText: string = $tw.wiki.getTiddlerText(
private themeButtonText: string = $tw.wiki.renderTiddler(
'text/html',
'$:/core/images/palette',
)!;
private saveTiddler!: (reinit?: boolean) => void;
Expand Down Expand Up @@ -181,16 +186,15 @@ class ElixirWidget extends Widget {
}

// 加载/创建数据
let dataAndOptions = {
options: {} as Record<string, any>,
} as any;
try {
dataAndOptions = JSON.parse(
$tw.wiki.getTiddler(this.stateTiddler)?.fields?.[
this.stateTiddlerField
] as any,
);
} catch {}
const dataAndOptions = $tw.utils.parseJSONSafe<{
options: Record<string, any>;
data?: Record<string, any>;
}>(
$tw.wiki.getTiddler(this.stateTiddler)?.fields?.[
this.stateTiddlerField
] as any,
() => ({ options: {} }),
);

try {
// Configure
Expand Down Expand Up @@ -398,7 +402,7 @@ class ElixirWidget extends Widget {

const themeIcon = $tw.utils.domMaker('span', {
attributes: {
id: 'export',
id: 'theme',
},
});
themeIcon.innerHTML = this.themeButtonText;
Expand Down Expand Up @@ -487,9 +491,13 @@ class ElixirWidget extends Widget {
});
}
};
svg.removeAttribute('width');
svg.removeAttribute('height');
svg.removeAttribute('class');
try {
svg.removeAttribute('width');
svg.removeAttribute('height');
svg.removeAttribute('class');
} catch {
//
}
svg.classList.add('icon');
svg.ariaHidden = 'true';
}
Expand Down
10 changes: 5 additions & 5 deletions src/notionpage-covericon/body.tid
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ list-before: $:/core/ui/ViewTemplate/title
<div>
<span style="user-select:none;opacity:0.8;font-weight:800;">URI:&nbsp;</span>
<$edit-text tiddler=<<state>> field="page-cover" default={{{ [<tiddler>get[page-cover]] }}} placeholder="" focus="true"/>
<$button setTitle=<<tiddler>> setField="page-cover" setTo={{{ [<state>get[page-cover]!is[blank]else<cover-bg-blur>] }}}>Set</$button>
<$button setTitle=<<tiddler>> setField="page-cover" setTo={{{ [<state>get[page-cover]!is[blank]else<cover-bg-blur>] }}} style="color:inherit !important;cursor:pointer;font-weight:800;">Set</$button>
</div>
<div>
<span style="user-select:none;opacity:0.8;font-weight:800;">Blur:&nbsp;</span>
<$edit-text tiddler=<<state>> field="page-cover#bg-blur" default=<<cover-bg-blur>> placeholder="" focus="true"/>
<$button setTitle=<<tiddler>> setField="page-cover#bg-blur" setTo={{{ [<state>get[page-cover#bg-blur]!is[blank]else<cover-bg-blur>] }}}>Set</$button>
<$button setTitle=<<tiddler>> setField="page-cover#bg-blur" setTo={{{ [<state>get[page-cover#bg-blur]!is[blank]else<cover-bg-blur>] }}} style="color:inherit !important;cursor:pointer;font-weight:800;">Set</$button>
</div>
<div>
<span style="user-select:none;opacity:0.8;font-weight:800;">Size:&nbsp;</span>
<$edit-text tiddler=<<state>> field="page-cover#size" default=<<cover-size>> placeholder="" focus="true"/>
<$button setTitle=<<tiddler>> setField="page-cover#size" setTo={{{ [<state>get[page-cover#size]!is[blank]else<cover-size>] }}}>Set</$button>
<$button setTitle=<<tiddler>> setField="page-cover#size" setTo={{{ [<state>get[page-cover#size]!is[blank]else<cover-size>] }}} style="color:inherit !important;cursor:pointer;font-weight:800;">Set</$button>
</div>
<div>
<span style="user-select:none;opacity:0.8;font-weight:800;">Position:&nbsp;</span>
<$edit-text tiddler=<<state>> field="page-cover#position" default=<<cover-position>> placeholder="" focus="true"/>
<$button setTitle=<<tiddler>> setField="page-cover#position" setTo={{{ [<state>get[page-cover#position]!is[blank]else<cover-position>] }}}>Set</$button>
<$button setTitle=<<tiddler>> setField="page-cover#position" setTo={{{ [<state>get[page-cover#position]!is[blank]else<cover-position>] }}} style="color:inherit !important;cursor:pointer;font-weight:800;">Set</$button>
</div>
<div>
<span style="user-select:none;opacity:0.8;font-weight:800;">Repeat:&nbsp;</span>
<$edit-text tiddler=<<state>> field="page-cover#repeat" default=<<cover-repeat>> placeholder="" focus="true"/>
<$button setTitle=<<tiddler>> setField="page-cover#repeat" setTo={{{ [<state>get[page-cover#position]!is[blank]else<cover-repeat>] }}}>Set</$button>
<$button setTitle=<<tiddler>> setField="page-cover#repeat" setTo={{{ [<state>get[page-cover#position]!is[blank]else<cover-repeat>] }}} style="color:inherit !important;cursor:pointer;font-weight:800;">Set</$button>
</div>
</div>
</$let>
Expand Down
2 changes: 1 addition & 1 deletion src/notionpage-covericon/plugin.info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.0.12",
"version": "0.0.13",
"type": "application/json",
"title": "$:/plugins/Gk0Wk/notionpage-covericon",
"plugin-type": "plugin",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"types": ["node", "tw5-typed"],
"lib": ["DOM", "ESNext"]
},
"include": ["src", "src-tmp/test", "src-tmp/pdf-printer"],
"include": ["src", "src-tmp/test", "src-tmp/pdf-printer", "src/mindmap-elixir/mind-elixir.min.js"],
"exclude": ["./**/*.js"]
}
2 changes: 1 addition & 1 deletion wiki/tiddlers/$__plugins_Gk0Wk_CPL-Repo.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions wiki/tiddlers/$__plugins_Gk0Wk_CPL-Repo.json.meta
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
author: Gk0Wk
description: Repos for CPL
description: Essential and powerful plugin manager and library
list: readme
name: CPL Repo
plugin-type: plugin
title: $:/plugins/Gk0Wk/CPL-Repo
type: application/json
version: 2022.12.28
version: 2023.10.11
Loading

0 comments on commit 022274a

Please sign in to comment.