@parallelworks/tandem-web 0.140.0 → 0.141.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_virtual/_virtual_i18n/en/common.js +22 -1
- package/_virtual/_virtual_i18n/es/common.js +22 -1
- package/_virtual/_virtual_i18n/ja/common.js +22 -1
- package/_virtual/_virtual_i18n/ko/common.js +22 -1
- package/_virtual/_virtual_i18n/zh/common.js +22 -1
- package/components/DocButton.js +221 -0
- package/components/Editor.js +77 -75
- package/components/SlashMenu.js +2 -0
- package/lib/docs.js +158 -123
- package/package.json +1 -1
- package/routes/_workspace/notifications2.js +205 -234
- package/styles.css +4 -0
|
@@ -1178,7 +1178,6 @@ var e = {
|
|
|
1178
1178
|
invalid_project_parent: "A project goes under another project of this workspace, never under itself or a project under it, and projects nest at most {max} levels deep."
|
|
1179
1179
|
},
|
|
1180
1180
|
notifications: {
|
|
1181
|
-
alsoHappened: "Also on this issue",
|
|
1182
1181
|
title: "Notifications",
|
|
1183
1182
|
unreadCount: "{count, plural, =0 {All caught up} other {# unread}}",
|
|
1184
1183
|
more: "+{count} more",
|
|
@@ -1281,6 +1280,7 @@ var e = {
|
|
|
1281
1280
|
description: "A team has its own issues, workflow and members. Its key starts each issue ID, as in ENG-42."
|
|
1282
1281
|
},
|
|
1283
1282
|
docs: {
|
|
1283
|
+
spaceDefault: "Start new docs in this space from it",
|
|
1284
1284
|
duplicate: "Duplicate",
|
|
1285
1285
|
copyOf: "Copy of {title}",
|
|
1286
1286
|
subPages: "Sub-pages",
|
|
@@ -2239,6 +2239,22 @@ var e = {
|
|
|
2239
2239
|
copyLink: "Copy link to heading",
|
|
2240
2240
|
delete: "Delete"
|
|
2241
2241
|
},
|
|
2242
|
+
docButton: {
|
|
2243
|
+
untitled: "Button",
|
|
2244
|
+
edit: "Change the button",
|
|
2245
|
+
label: "Label",
|
|
2246
|
+
labelPlaceholder: "Add this week",
|
|
2247
|
+
does: "When pressed",
|
|
2248
|
+
insert: "Insert blocks",
|
|
2249
|
+
makeDoc: "Make a doc",
|
|
2250
|
+
blocks: "Blocks to insert, in Markdown",
|
|
2251
|
+
blocksPlaceholder: "## Week of '{{date}}'\n\n- [ ] ",
|
|
2252
|
+
placeholders: "'{{date}}', '{{time}}' and '{{author}}' are filled in when it's pressed.",
|
|
2253
|
+
template: "Template",
|
|
2254
|
+
chooseTemplate: "Choose a template",
|
|
2255
|
+
parent: "Under",
|
|
2256
|
+
thisDoc: "This doc"
|
|
2257
|
+
},
|
|
2242
2258
|
linkCard: {
|
|
2243
2259
|
address: "Address of the page",
|
|
2244
2260
|
make: "Make card",
|
|
@@ -2373,6 +2389,11 @@ var e = {
|
|
|
2373
2389
|
hint: "Rows and columns",
|
|
2374
2390
|
keywords: "grid columns rows"
|
|
2375
2391
|
},
|
|
2392
|
+
button: {
|
|
2393
|
+
label: "Button",
|
|
2394
|
+
hint: "A button that inserts blocks or makes a doc from a template",
|
|
2395
|
+
keywords: "button template insert repeat weekly"
|
|
2396
|
+
},
|
|
2376
2397
|
diagram: {
|
|
2377
2398
|
label: "Diagram",
|
|
2378
2399
|
hint: "A flowchart, sequence, state or Gantt diagram drawn from Mermaid text",
|
|
@@ -1178,7 +1178,6 @@ var e = {
|
|
|
1178
1178
|
invalid_project_parent: "Un proyecto va bajo otro proyecto de este espacio de trabajo, nunca bajo sí mismo ni bajo uno de sus subproyectos, y los proyectos se anidan como máximo {max} niveles."
|
|
1179
1179
|
},
|
|
1180
1180
|
notifications: {
|
|
1181
|
-
alsoHappened: "También en esta incidencia",
|
|
1182
1181
|
title: "Notificaciones",
|
|
1183
1182
|
unreadCount: "{count, plural, =0 {Todo al día} one {# sin leer} other {# sin leer}}",
|
|
1184
1183
|
more: "+{count} más",
|
|
@@ -1281,6 +1280,7 @@ var e = {
|
|
|
1281
1280
|
description: "Un equipo tiene sus propias incidencias, flujo de trabajo y miembros. Su clave inicia el ID de cada incidencia, como en ENG-42."
|
|
1282
1281
|
},
|
|
1283
1282
|
docs: {
|
|
1283
|
+
spaceDefault: "Empezar los documentos nuevos de este espacio con ella",
|
|
1284
1284
|
duplicate: "Duplicar",
|
|
1285
1285
|
copyOf: "Copia de {title}",
|
|
1286
1286
|
subPages: "Subpáginas",
|
|
@@ -2239,6 +2239,22 @@ var e = {
|
|
|
2239
2239
|
copyLink: "Copiar enlace al encabezado",
|
|
2240
2240
|
delete: "Eliminar"
|
|
2241
2241
|
},
|
|
2242
|
+
docButton: {
|
|
2243
|
+
untitled: "Botón",
|
|
2244
|
+
edit: "Cambiar el botón",
|
|
2245
|
+
label: "Etiqueta",
|
|
2246
|
+
labelPlaceholder: "Añadir esta semana",
|
|
2247
|
+
does: "Al pulsarlo",
|
|
2248
|
+
insert: "Insertar bloques",
|
|
2249
|
+
makeDoc: "Crear un documento",
|
|
2250
|
+
blocks: "Bloques que inserta, en Markdown",
|
|
2251
|
+
blocksPlaceholder: "## Semana del '{{date}}'\n\n- [ ] ",
|
|
2252
|
+
placeholders: "'{{date}}', '{{time}}' y '{{author}}' se rellenan al pulsarlo.",
|
|
2253
|
+
template: "Plantilla",
|
|
2254
|
+
chooseTemplate: "Elige una plantilla",
|
|
2255
|
+
parent: "Dentro de",
|
|
2256
|
+
thisDoc: "Este documento"
|
|
2257
|
+
},
|
|
2242
2258
|
linkCard: {
|
|
2243
2259
|
address: "Dirección de la página",
|
|
2244
2260
|
make: "Crear tarjeta",
|
|
@@ -2373,6 +2389,11 @@ var e = {
|
|
|
2373
2389
|
hint: "Filas y columnas",
|
|
2374
2390
|
keywords: "cuadrícula columnas filas grid columns rows"
|
|
2375
2391
|
},
|
|
2392
|
+
button: {
|
|
2393
|
+
label: "Botón",
|
|
2394
|
+
hint: "Un botón que inserta bloques o crea un documento desde una plantilla",
|
|
2395
|
+
keywords: "botón plantilla insertar repetir button"
|
|
2396
|
+
},
|
|
2376
2397
|
diagram: {
|
|
2377
2398
|
label: "Diagrama",
|
|
2378
2399
|
hint: "Un diagrama de flujo, secuencia, estados o Gantt a partir de texto Mermaid",
|
|
@@ -1178,7 +1178,6 @@ var e = {
|
|
|
1178
1178
|
invalid_project_parent: "プロジェクトは、このワークスペースの別のプロジェクトの下に置けます。自分自身や自分の下のプロジェクトの下には置けず、入れ子は最大 {max} 階層までです。"
|
|
1179
1179
|
},
|
|
1180
1180
|
notifications: {
|
|
1181
|
-
alsoHappened: "この課題のその他の動き",
|
|
1182
1181
|
title: "通知",
|
|
1183
1182
|
unreadCount: "{count, plural, =0 {すべて確認済み} other {未読 # 件}}",
|
|
1184
1183
|
more: "他 {count} 件",
|
|
@@ -1281,6 +1280,7 @@ var e = {
|
|
|
1281
1280
|
description: "チームには独自の課題、ワークフロー、メンバーがあります。チームのキーは ENG-42 のように各課題 ID の先頭に付きます。"
|
|
1282
1281
|
},
|
|
1283
1282
|
docs: {
|
|
1283
|
+
spaceDefault: "このスペースの新しいドキュメントに使う",
|
|
1284
1284
|
duplicate: "複製",
|
|
1285
1285
|
copyOf: "{title} のコピー",
|
|
1286
1286
|
subPages: "サブページ",
|
|
@@ -2239,6 +2239,22 @@ var e = {
|
|
|
2239
2239
|
copyLink: "見出しへのリンクをコピー",
|
|
2240
2240
|
delete: "削除"
|
|
2241
2241
|
},
|
|
2242
|
+
docButton: {
|
|
2243
|
+
untitled: "ボタン",
|
|
2244
|
+
edit: "ボタンを変更",
|
|
2245
|
+
label: "ラベル",
|
|
2246
|
+
labelPlaceholder: "今週を追加",
|
|
2247
|
+
does: "押したとき",
|
|
2248
|
+
insert: "ブロックを挿入",
|
|
2249
|
+
makeDoc: "ドキュメントを作成",
|
|
2250
|
+
blocks: "挿入するブロック(Markdown)",
|
|
2251
|
+
blocksPlaceholder: "## '{{date}}' の週\n\n- [ ] ",
|
|
2252
|
+
placeholders: "'{{date}}'、'{{time}}'、'{{author}}' は押したときに埋まります。",
|
|
2253
|
+
template: "テンプレート",
|
|
2254
|
+
chooseTemplate: "テンプレートを選択",
|
|
2255
|
+
parent: "親",
|
|
2256
|
+
thisDoc: "このドキュメント"
|
|
2257
|
+
},
|
|
2242
2258
|
linkCard: {
|
|
2243
2259
|
address: "ページのアドレス",
|
|
2244
2260
|
make: "カードを作成",
|
|
@@ -2373,6 +2389,11 @@ var e = {
|
|
|
2373
2389
|
hint: "行と列",
|
|
2374
2390
|
keywords: "grid columns rows 表 テーブル 行 列"
|
|
2375
2391
|
},
|
|
2392
|
+
button: {
|
|
2393
|
+
label: "ボタン",
|
|
2394
|
+
hint: "ブロックを挿入したりテンプレートからドキュメントを作るボタン",
|
|
2395
|
+
keywords: "ボタン テンプレート 挿入 button"
|
|
2396
|
+
},
|
|
2376
2397
|
diagram: {
|
|
2377
2398
|
label: "図",
|
|
2378
2399
|
hint: "Mermaid のテキストから描くフローチャート、シーケンス、状態、ガントの図",
|
|
@@ -1178,7 +1178,6 @@ var e = {
|
|
|
1178
1178
|
invalid_project_parent: "프로젝트는 이 워크스페이스의 다른 프로젝트 아래에 둘 수 있으며, 자기 자신이나 그 아래 프로젝트 아래에는 둘 수 없고, 최대 {max}단계까지 중첩됩니다."
|
|
1179
1179
|
},
|
|
1180
1180
|
notifications: {
|
|
1181
|
-
alsoHappened: "이 이슈의 다른 활동",
|
|
1182
1181
|
title: "알림",
|
|
1183
1182
|
unreadCount: "{count, plural, =0 {모두 확인함} other {#개 읽지 않음}}",
|
|
1184
1183
|
more: "+{count}개 더",
|
|
@@ -1281,6 +1280,7 @@ var e = {
|
|
|
1281
1280
|
description: "팀마다 고유한 이슈, 워크플로, 멤버가 있습니다. 팀 키는 ENG-42처럼 각 이슈 ID의 앞부분이 됩니다."
|
|
1282
1281
|
},
|
|
1283
1282
|
docs: {
|
|
1283
|
+
spaceDefault: "이 스페이스의 새 문서에 사용",
|
|
1284
1284
|
duplicate: "복제",
|
|
1285
1285
|
copyOf: "{title} 사본",
|
|
1286
1286
|
subPages: "하위 페이지",
|
|
@@ -2239,6 +2239,22 @@ var e = {
|
|
|
2239
2239
|
copyLink: "제목 링크 복사",
|
|
2240
2240
|
delete: "삭제"
|
|
2241
2241
|
},
|
|
2242
|
+
docButton: {
|
|
2243
|
+
untitled: "버튼",
|
|
2244
|
+
edit: "버튼 변경",
|
|
2245
|
+
label: "레이블",
|
|
2246
|
+
labelPlaceholder: "이번 주 추가",
|
|
2247
|
+
does: "누르면",
|
|
2248
|
+
insert: "블록 넣기",
|
|
2249
|
+
makeDoc: "문서 만들기",
|
|
2250
|
+
blocks: "넣을 블록(Markdown)",
|
|
2251
|
+
blocksPlaceholder: "## '{{date}}' 주\n\n- [ ] ",
|
|
2252
|
+
placeholders: "'{{date}}', '{{time}}', '{{author}}'는 누를 때 채워집니다.",
|
|
2253
|
+
template: "템플릿",
|
|
2254
|
+
chooseTemplate: "템플릿 선택",
|
|
2255
|
+
parent: "상위",
|
|
2256
|
+
thisDoc: "이 문서"
|
|
2257
|
+
},
|
|
2242
2258
|
linkCard: {
|
|
2243
2259
|
address: "페이지 주소",
|
|
2244
2260
|
make: "카드 만들기",
|
|
@@ -2373,6 +2389,11 @@ var e = {
|
|
|
2373
2389
|
hint: "행과 열",
|
|
2374
2390
|
keywords: "표 테이블 그리드 열 행 grid columns rows"
|
|
2375
2391
|
},
|
|
2392
|
+
button: {
|
|
2393
|
+
label: "버튼",
|
|
2394
|
+
hint: "블록을 넣거나 템플릿으로 문서를 만드는 버튼",
|
|
2395
|
+
keywords: "버튼 템플릿 삽입 button"
|
|
2396
|
+
},
|
|
2376
2397
|
diagram: {
|
|
2377
2398
|
label: "다이어그램",
|
|
2378
2399
|
hint: "Mermaid 텍스트로 그리는 순서도, 시퀀스, 상태, 간트 다이어그램",
|
|
@@ -1178,7 +1178,6 @@ var e = {
|
|
|
1178
1178
|
invalid_project_parent: "项目可以放在此工作区的另一个项目之下,但不能放在自身或其下级项目之下,且最多嵌套 {max} 层。"
|
|
1179
1179
|
},
|
|
1180
1180
|
notifications: {
|
|
1181
|
-
alsoHappened: "此问题的其他动态",
|
|
1182
1181
|
title: "通知",
|
|
1183
1182
|
unreadCount: "{count, plural, =0 {已全部读完} other {# 条未读}}",
|
|
1184
1183
|
more: "还有 {count} 条",
|
|
@@ -1281,6 +1280,7 @@ var e = {
|
|
|
1281
1280
|
description: "团队拥有自己的议题、工作流和成员。团队标识会作为每个议题 ID 的开头,例如 ENG-42。"
|
|
1282
1281
|
},
|
|
1283
1282
|
docs: {
|
|
1283
|
+
spaceDefault: "此空间的新文档从它开始",
|
|
1284
1284
|
duplicate: "复制一份",
|
|
1285
1285
|
copyOf: "{title} 的副本",
|
|
1286
1286
|
subPages: "子页面",
|
|
@@ -2239,6 +2239,22 @@ var e = {
|
|
|
2239
2239
|
copyLink: "复制标题链接",
|
|
2240
2240
|
delete: "删除"
|
|
2241
2241
|
},
|
|
2242
|
+
docButton: {
|
|
2243
|
+
untitled: "按钮",
|
|
2244
|
+
edit: "更改按钮",
|
|
2245
|
+
label: "标签",
|
|
2246
|
+
labelPlaceholder: "添加本周",
|
|
2247
|
+
does: "按下时",
|
|
2248
|
+
insert: "插入块",
|
|
2249
|
+
makeDoc: "创建文档",
|
|
2250
|
+
blocks: "要插入的块(Markdown)",
|
|
2251
|
+
blocksPlaceholder: "## '{{date}}' 当周\n\n- [ ] ",
|
|
2252
|
+
placeholders: "按下时会填入 '{{date}}'、'{{time}}' 和 '{{author}}'。",
|
|
2253
|
+
template: "模板",
|
|
2254
|
+
chooseTemplate: "选择模板",
|
|
2255
|
+
parent: "上级",
|
|
2256
|
+
thisDoc: "此文档"
|
|
2257
|
+
},
|
|
2242
2258
|
linkCard: {
|
|
2243
2259
|
address: "页面地址",
|
|
2244
2260
|
make: "创建卡片",
|
|
@@ -2373,6 +2389,11 @@ var e = {
|
|
|
2373
2389
|
hint: "行和列",
|
|
2374
2390
|
keywords: "表格 网格 列 行 grid columns rows"
|
|
2375
2391
|
},
|
|
2392
|
+
button: {
|
|
2393
|
+
label: "按钮",
|
|
2394
|
+
hint: "插入块或从模板创建文档的按钮",
|
|
2395
|
+
keywords: "按钮 模板 插入 button"
|
|
2396
|
+
},
|
|
2376
2397
|
diagram: {
|
|
2377
2398
|
label: "图表",
|
|
2378
2399
|
hint: "用 Mermaid 文本绘制的流程图、时序图、状态图或甘特图",
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { api as e, unwrap as t } from "../api/client.js";
|
|
2
|
+
import { docQuery as n, docTemplatesQuery as r, docsQuery as i } from "../api/queries.js";
|
|
3
|
+
import { EditIcon as a } from "./icons.js";
|
|
4
|
+
import { docKey as o, docRef as s, useTemplateValues as c } from "../lib/docs.js";
|
|
5
|
+
import { closingFence as l } from "./toggle.js";
|
|
6
|
+
import { Button as u, Combobox as d, IconButton as f, Input as p, Popover as m, SegmentedControl as h, Select as g, Textarea as _ } from "@parallelworks/ui";
|
|
7
|
+
import { useNavigate as v, useParams as y } from "@tanstack/react-router";
|
|
8
|
+
import { useState as b } from "react";
|
|
9
|
+
import { useTranslations as x } from "use-intl";
|
|
10
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
11
|
+
import { useQuery as w } from "@tanstack/react-query";
|
|
12
|
+
import { Node as T, NodeViewWrapper as E, ReactNodeViewRenderer as D, mergeAttributes as O } from "@tiptap/react";
|
|
13
|
+
// src/components/DocButton.tsx
|
|
14
|
+
var k = /^:::button[ \t]*([^\n]*)\n/, A = /\s+(template|parent)=([\w-]+)/g, j = T.create({
|
|
15
|
+
name: "docButton",
|
|
16
|
+
group: "block",
|
|
17
|
+
atom: !0,
|
|
18
|
+
draggable: !0,
|
|
19
|
+
addAttributes: () => ({
|
|
20
|
+
label: { default: "" },
|
|
21
|
+
action: { default: "insert" },
|
|
22
|
+
blocks: { default: "" },
|
|
23
|
+
template: { default: "" },
|
|
24
|
+
parent: { default: "" }
|
|
25
|
+
}),
|
|
26
|
+
parseHTML: () => [{ tag: "div[data-doc-button]" }],
|
|
27
|
+
renderHTML: ({ node: e, HTMLAttributes: t }) => [
|
|
28
|
+
"div",
|
|
29
|
+
O(t, { "data-doc-button": "" }),
|
|
30
|
+
String(e.attrs.label)
|
|
31
|
+
],
|
|
32
|
+
addNodeView: () => D(M, { stopEvent: ({ event: e }) => e.target instanceof Element && !!e.target.closest("[data-button-ui]") }),
|
|
33
|
+
markdownTokenName: "docButton",
|
|
34
|
+
markdownTokenizer: {
|
|
35
|
+
name: "docButton",
|
|
36
|
+
level: "block",
|
|
37
|
+
start: (e) => e.search(/^:::button/m),
|
|
38
|
+
tokenize: (e) => {
|
|
39
|
+
let t = k.exec(e);
|
|
40
|
+
if (!t) return;
|
|
41
|
+
let n = e.slice(t[0].length), r = l(n);
|
|
42
|
+
if (r) return {
|
|
43
|
+
type: "docButton",
|
|
44
|
+
raw: e.slice(0, t[0].length + r.index + r.length),
|
|
45
|
+
text: n.slice(0, r.index).trim(),
|
|
46
|
+
head: t[1] ?? ""
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
parseMarkdown: (e, t) => {
|
|
51
|
+
let n = String(e.head ?? ""), r = {};
|
|
52
|
+
for (let e of n.matchAll(A)) r[e[1] ?? ""] = e[2] ?? "";
|
|
53
|
+
return t.createNode("docButton", {
|
|
54
|
+
label: n.replace(A, "").trim(),
|
|
55
|
+
action: r.template ? "doc" : "insert",
|
|
56
|
+
blocks: e.text ?? "",
|
|
57
|
+
template: r.template ?? "",
|
|
58
|
+
parent: r.parent ?? ""
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
renderMarkdown: (e) => {
|
|
62
|
+
let t = e.attrs ?? {}, n = String(t.label ?? "").replace(/\n/g, " ");
|
|
63
|
+
if (t.action === "doc") {
|
|
64
|
+
let e = t.parent ? ` parent=${t.parent}` : "";
|
|
65
|
+
return `:::button ${n} template=${t.template ?? ""}${e}\n:::`;
|
|
66
|
+
}
|
|
67
|
+
return `:::button ${n}\n\n${String(t.blocks ?? "").trim()}\n\n:::`;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
function M({ node: r, editor: i, getPos: l, updateAttributes: d }) {
|
|
71
|
+
let p = x("docButton"), h = v(), g = c(), { workspace: _ = "", doc: T = "" } = y({ strict: !1 }), { data: D } = w({
|
|
72
|
+
...n(_, T),
|
|
73
|
+
enabled: !!_ && !!T
|
|
74
|
+
}), [O, k] = b(!1), A = String(r.attrs.label ?? "") || p("untitled"), j = r.attrs.action, M = j === "doc" ? !!r.attrs.template : !!String(r.attrs.blocks ?? "").trim(), P = async () => {
|
|
75
|
+
if (j === "insert") {
|
|
76
|
+
let e = g(), t = Object.entries(e).reduce((e, [t, n]) => e.replaceAll(`{{${t}}}`, n), String(r.attrs.blocks ?? "")), n = l();
|
|
77
|
+
if (n === void 0) return;
|
|
78
|
+
i.chain().focus().insertContentAt(n + r.nodeSize, t, { contentType: "markdown" }).run();
|
|
79
|
+
} else {
|
|
80
|
+
k(!0);
|
|
81
|
+
try {
|
|
82
|
+
let n = String(r.attrs.parent ?? "") || D?.key, i = t(await e.POST("/api/v1/workspaces/{workspace}/docs", {
|
|
83
|
+
params: { path: { workspace: _ } },
|
|
84
|
+
body: {
|
|
85
|
+
template: String(r.attrs.template),
|
|
86
|
+
variables: g(),
|
|
87
|
+
...n && { parent: n }
|
|
88
|
+
}
|
|
89
|
+
}));
|
|
90
|
+
h({
|
|
91
|
+
to: "/$workspace/docs/$doc",
|
|
92
|
+
params: {
|
|
93
|
+
workspace: _,
|
|
94
|
+
doc: s(i)
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
} finally {
|
|
98
|
+
k(!1);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ S(E, {
|
|
103
|
+
className: "doc-button",
|
|
104
|
+
contentEditable: !1,
|
|
105
|
+
children: /* @__PURE__ */ C("div", {
|
|
106
|
+
"data-button-ui": !0,
|
|
107
|
+
className: "flex items-center gap-1",
|
|
108
|
+
children: [/* @__PURE__ */ S(u, {
|
|
109
|
+
size: "sm",
|
|
110
|
+
onClick: () => void P(),
|
|
111
|
+
disabled: !i.isEditable || !M,
|
|
112
|
+
loading: O,
|
|
113
|
+
children: A
|
|
114
|
+
}), i.isEditable && /* @__PURE__ */ S(m, {
|
|
115
|
+
trigger: /* @__PURE__ */ S(f, {
|
|
116
|
+
variant: "ghost",
|
|
117
|
+
size: "xs",
|
|
118
|
+
icon: /* @__PURE__ */ S(a, {}),
|
|
119
|
+
label: p("edit")
|
|
120
|
+
}),
|
|
121
|
+
align: "start",
|
|
122
|
+
className: "w-96",
|
|
123
|
+
initialFocus: "first-control",
|
|
124
|
+
"aria-label": p("edit"),
|
|
125
|
+
children: /* @__PURE__ */ S(N, {
|
|
126
|
+
workspace: _,
|
|
127
|
+
attrs: r.attrs,
|
|
128
|
+
thisDoc: D?.key ?? (T ? o(T) : ""),
|
|
129
|
+
onChange: d
|
|
130
|
+
})
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function N({ workspace: e, attrs: t, thisDoc: n, onChange: a }) {
|
|
136
|
+
let o = x("docButton"), { data: s = [] } = w(r(e)), { data: c = [] } = w(i(e)), l = t.action;
|
|
137
|
+
return /* @__PURE__ */ C("div", {
|
|
138
|
+
className: "space-y-3 text-sm",
|
|
139
|
+
children: [
|
|
140
|
+
/* @__PURE__ */ C("label", {
|
|
141
|
+
className: "block text-xs font-medium text-muted-foreground",
|
|
142
|
+
children: [o("label"), /* @__PURE__ */ S(p, {
|
|
143
|
+
value: String(t.label ?? ""),
|
|
144
|
+
onChange: (e) => a({ label: e.target.value }),
|
|
145
|
+
placeholder: o("labelPlaceholder"),
|
|
146
|
+
className: "mt-1"
|
|
147
|
+
})]
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ S(h, {
|
|
150
|
+
label: o("does"),
|
|
151
|
+
size: "sm",
|
|
152
|
+
value: l,
|
|
153
|
+
onValueChange: (e) => a({ action: e }),
|
|
154
|
+
options: [{
|
|
155
|
+
value: "insert",
|
|
156
|
+
label: o("insert")
|
|
157
|
+
}, {
|
|
158
|
+
value: "doc",
|
|
159
|
+
label: o("makeDoc")
|
|
160
|
+
}]
|
|
161
|
+
}),
|
|
162
|
+
l === "insert" ? /* @__PURE__ */ C("label", {
|
|
163
|
+
className: "block text-xs font-medium text-muted-foreground",
|
|
164
|
+
children: [
|
|
165
|
+
o("blocks"),
|
|
166
|
+
/* @__PURE__ */ S(_, {
|
|
167
|
+
value: String(t.blocks ?? ""),
|
|
168
|
+
onChange: (e) => a({ blocks: e.target.value }),
|
|
169
|
+
rows: 6,
|
|
170
|
+
placeholder: o("blocksPlaceholder"),
|
|
171
|
+
className: "mt-1 font-mono text-xs"
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ S("span", {
|
|
174
|
+
className: "mt-1 block font-normal",
|
|
175
|
+
children: o("placeholders")
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}) : /* @__PURE__ */ C("div", {
|
|
179
|
+
className: "space-y-2",
|
|
180
|
+
children: [/* @__PURE__ */ C("div", {
|
|
181
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
182
|
+
children: [o("template"), /* @__PURE__ */ S("div", {
|
|
183
|
+
className: "mt-1",
|
|
184
|
+
children: /* @__PURE__ */ S(g, {
|
|
185
|
+
value: String(t.template ?? ""),
|
|
186
|
+
items: [{
|
|
187
|
+
value: "",
|
|
188
|
+
label: o("chooseTemplate")
|
|
189
|
+
}, ...s.map((e) => ({
|
|
190
|
+
value: e.id,
|
|
191
|
+
label: e.title
|
|
192
|
+
}))],
|
|
193
|
+
onValueChange: (e) => a({ template: e }),
|
|
194
|
+
"aria-label": o("template"),
|
|
195
|
+
width: "content"
|
|
196
|
+
})
|
|
197
|
+
})]
|
|
198
|
+
}), /* @__PURE__ */ C("div", {
|
|
199
|
+
className: "text-xs font-medium text-muted-foreground",
|
|
200
|
+
children: [o("parent"), /* @__PURE__ */ S("div", {
|
|
201
|
+
className: "mt-1",
|
|
202
|
+
children: /* @__PURE__ */ S(d, {
|
|
203
|
+
items: [{
|
|
204
|
+
value: "",
|
|
205
|
+
label: o("thisDoc")
|
|
206
|
+
}, ...c.filter((e) => e.key !== n).map((e) => ({
|
|
207
|
+
value: e.key,
|
|
208
|
+
label: e.title
|
|
209
|
+
}))],
|
|
210
|
+
value: String(t.parent ?? ""),
|
|
211
|
+
onValueChange: (e) => e !== null && a({ parent: e }),
|
|
212
|
+
"aria-label": o("parent"),
|
|
213
|
+
placeholder: o("parent")
|
|
214
|
+
})
|
|
215
|
+
})]
|
|
216
|
+
})]
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
export { j as DocButton };
|