@design.estate/dees-catalog 21.42.0 → 21.44.0
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/dist_bundle/bundle.js +541 -182
- package/dist_bundle/bundle.js.map +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-72W55DOJ.js → chunk-ETDITRNI.js} +4 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-72W55DOJ.js.map → chunk-ETDITRNI.js.map} +1 -1
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PAFNUCDL.js → chunk-UD6S2QIF.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GTAAYRP5.js → chunk-WZGJITN2.js} +2 -2
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-CQ56NZVB.js → de-NIKZVWN2.js} +4 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-NIKZVWN2.js.map +1 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JNRW3HIY.js → dees-modal-BOGBX6EB.js} +3 -3
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-Y532Z546.js → dees-workspace-terminal-M3DB4LUI.js} +4 -4
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.d.ts +20 -4
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.demo.js +21 -4
- package/dist_ts_web/elements/00group-dataview/dees-thread/dees-thread.js +65 -10
- package/dist_ts_web/elements/00group-dataview/dees-thread/interfaces.d.ts +5 -0
- package/dist_ts_web/elements/00group-dataview/dees-thread/thread.markdown.d.ts +2 -1
- package/dist_ts_web/elements/00group-dataview/dees-thread/thread.markdown.js +6 -3
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +2 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +2 -1
- package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.d.ts +10 -2
- package/dist_ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.js +26 -6
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.d.ts +2 -0
- package/dist_ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.js +3 -2
- package/dist_ts_web/elements/00group-input/dees-input-reference/dees-input-reference.d.ts +1 -7
- package/dist_ts_web/elements/00group-input/dees-input-reference/dees-input-reference.js +22 -97
- package/dist_ts_web/elements/00group-input/dees-input-richtext/component.d.ts +23 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/component.js +105 -5
- package/dist_ts_web/elements/00group-input/dees-input-richtext/demo.js +29 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/index.d.ts +1 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/index.js +5 -2
- package/dist_ts_web/elements/00group-input/dees-input-richtext/markdown.d.ts +21 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/markdown.js +90 -6
- package/dist_ts_web/elements/00group-input/dees-input-richtext/references.d.ts +52 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/references.js +152 -0
- package/dist_ts_web/elements/00group-input/dees-input-richtext/styles.js +23 -1
- package/dist_ts_web/elements/00group-input/dees-input-richtext/template.js +2 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +6 -1
- package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.d.ts +15 -2
- package/dist_ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.js +44 -11
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +7 -0
- package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +67 -5
- package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +2 -2
- package/dist_ts_web/i18n/de.d.ts +6 -2
- package/dist_ts_web/i18n/de.js +3 -2
- package/dist_ts_web/i18n/messages.d.ts +6 -2
- package/dist_ts_web/i18n/messages.js +3 -2
- package/dist_ts_web/richtextmarkdown.d.ts +5 -1
- package/dist_ts_web/richtextmarkdown.js +6 -2
- package/package.json +1 -1
- package/readme.md +68 -12
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/00group-dataview/dees-thread/dees-thread.demo.ts +23 -3
- package/ts_web/elements/00group-dataview/dees-thread/dees-thread.ts +50 -7
- package/ts_web/elements/00group-dataview/dees-thread/interfaces.ts +6 -0
- package/ts_web/elements/00group-dataview/dees-thread/thread.markdown.ts +5 -2
- package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +2 -1
- package/ts_web/elements/00group-harness/dees-harness-composer/dees-harness-composer.ts +28 -5
- package/ts_web/elements/00group-input/dees-input-multitoggle/dees-input-multitoggle.ts +4 -2
- package/ts_web/elements/00group-input/dees-input-reference/dees-input-reference.ts +20 -88
- package/ts_web/elements/00group-input/dees-input-richtext/component.ts +83 -3
- package/ts_web/elements/00group-input/dees-input-richtext/demo.ts +34 -0
- package/ts_web/elements/00group-input/dees-input-richtext/index.ts +6 -0
- package/ts_web/elements/00group-input/dees-input-richtext/markdown.ts +93 -5
- package/ts_web/elements/00group-input/dees-input-richtext/references.ts +171 -0
- package/ts_web/elements/00group-input/dees-input-richtext/styles.ts +22 -0
- package/ts_web/elements/00group-input/dees-input-richtext/template.ts +1 -0
- package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +5 -0
- package/ts_web/elements/00group-kanban/dees-kanban-discussion/dees-kanban-discussion.ts +39 -10
- package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +61 -3
- package/ts_web/elements/00group-kanban/kanban.demodata.ts +1 -1
- package/ts_web/i18n/de.ts +2 -1
- package/ts_web/i18n/messages.ts +2 -1
- package/ts_web/richtextmarkdown.ts +8 -0
- package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-CQ56NZVB.js.map +0 -1
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-PAFNUCDL.js.map → chunk-UD6S2QIF.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-GTAAYRP5.js.map → chunk-WZGJITN2.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-JNRW3HIY.js.map → dees-modal-BOGBX6EB.js.map} +0 -0
- /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-Y532Z546.js.map → dees-workspace-terminal-M3DB4LUI.js.map} +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { DeesElement } from '@design.estate/dees-element';
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import type { ITiptapBundle } from '../../../services/index.js';
|
|
4
|
+
import { provideOverlayI18n, type IOverlayI18nOptions } from '../../00overlay.js';
|
|
5
|
+
import { DeesInputDropdownPopup } from '../dees-input-dropdown/dees-input-dropdown-popup.js';
|
|
6
|
+
import type { IInputReference, TReferenceSearch } from '../dees-input-reference/interfaces.js';
|
|
7
|
+
import { referenceId, referenceType } from './markdown.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The editor's node for a reference to a record: an atom showing its `label`, focused and read as a
|
|
11
|
+
* link. In HTML it is `<span data-reference-id="…">label</span>`, in Markdown a link to
|
|
12
|
+
* `#reference:…` (`markdown.ts`); pasted, a reference link as a thread shows it is read as one too.
|
|
13
|
+
*/
|
|
14
|
+
export const referenceNode = (bundleArg: ITiptapBundle) =>
|
|
15
|
+
bundleArg.Node.create({
|
|
16
|
+
name: referenceType,
|
|
17
|
+
group: 'inline',
|
|
18
|
+
inline: true,
|
|
19
|
+
atom: true,
|
|
20
|
+
selectable: true,
|
|
21
|
+
addAttributes: () => ({
|
|
22
|
+
id: {
|
|
23
|
+
default: '',
|
|
24
|
+
parseHTML: (element: HTMLElement) => element.getAttribute('data-reference-id') ?? referenceId(element.getAttribute('href')) ?? '',
|
|
25
|
+
},
|
|
26
|
+
label: { default: '', parseHTML: (element: HTMLElement) => element.textContent ?? '' },
|
|
27
|
+
}),
|
|
28
|
+
parseHTML: () => [
|
|
29
|
+
{ tag: 'span[data-reference-id]' },
|
|
30
|
+
// before Link's `a[href]`
|
|
31
|
+
{
|
|
32
|
+
tag: 'a[href^="#reference:"]',
|
|
33
|
+
priority: 60,
|
|
34
|
+
getAttrs: (element: string | HTMLElement) =>
|
|
35
|
+
typeof element !== 'string' && referenceId(element.getAttribute('href')) !== null ? null : false,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
renderHTML: ({ node }) => ['span', { 'data-reference-id': String(node.attrs.id) }, String(node.attrs.label)],
|
|
39
|
+
renderText: ({ node }) => String(node.attrs.label),
|
|
40
|
+
// In the editor the reference is read-only and reached like a link; the HTML it writes stays plain.
|
|
41
|
+
addNodeView: () => ({ node }) => {
|
|
42
|
+
const dom = document.createElement('span');
|
|
43
|
+
dom.dataset.referenceId = String(node.attrs.id);
|
|
44
|
+
dom.contentEditable = 'false';
|
|
45
|
+
dom.setAttribute('role', 'link');
|
|
46
|
+
dom.tabIndex = 0;
|
|
47
|
+
dom.textContent = String(node.attrs.label);
|
|
48
|
+
return { dom };
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/** The editor a reference picker serves, read when it is needed. */
|
|
53
|
+
export interface IReferencePickerHost {
|
|
54
|
+
/** The element that owns the picker: the picker's overlay owner, and where its focus returns. */
|
|
55
|
+
element: DeesElement;
|
|
56
|
+
editor: () => Editor | undefined;
|
|
57
|
+
search: () => TReferenceSearch | undefined;
|
|
58
|
+
/** The search field's name. */
|
|
59
|
+
searchLabel: () => string;
|
|
60
|
+
/** The language the picker speaks: the host's `t.i18n`. */
|
|
61
|
+
i18n: () => IOverlayI18nOptions['i18n'];
|
|
62
|
+
disabled: () => boolean;
|
|
63
|
+
/** The picker could not open. */
|
|
64
|
+
failed: (errorArg: unknown) => void;
|
|
65
|
+
/** The picker opened: a failure reported before no longer stands. */
|
|
66
|
+
opened: () => void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The meta of the transaction that inserts a reference: the inserted text does not open the picker again. */
|
|
70
|
+
export const referenceInsertMeta = 'preventReferenceTrigger';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The reference picker of an editor: typing its trigger opens a search at the caret; the reference
|
|
74
|
+
* chosen there takes the trigger's place, followed by a space. Escape or a click elsewhere closes it
|
|
75
|
+
* and leaves the trigger as typed.
|
|
76
|
+
*/
|
|
77
|
+
export class ReferencePicker {
|
|
78
|
+
private popup?: DeesInputDropdownPopup;
|
|
79
|
+
private opening?: Promise<void>;
|
|
80
|
+
private range?: { from: number; to: number };
|
|
81
|
+
|
|
82
|
+
constructor(private readonly host: IReferencePickerHost) {}
|
|
83
|
+
|
|
84
|
+
public get isOpen(): boolean {
|
|
85
|
+
return !!this.popup;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Opens the picker when the text right before the caret is the trigger. `wordStart` asks for the
|
|
90
|
+
* trigger to start a word, outside code and links: `#` after a letter, as in `C#`, stays text.
|
|
91
|
+
*/
|
|
92
|
+
public detect(triggerArg: string, optionsArg: { wordStart?: boolean } = {}): void {
|
|
93
|
+
const editor = this.host.editor();
|
|
94
|
+
if (!editor || this.popup || this.host.disabled() || !this.host.search() || !triggerArg || editor.view.composing || !editor.isFocused) return;
|
|
95
|
+
const { from, to, $from } = editor.state.selection;
|
|
96
|
+
if (from !== to || $from.parentOffset < triggerArg.length) return;
|
|
97
|
+
if ($from.parent.textBetween($from.parentOffset - triggerArg.length, $from.parentOffset, '', '\ufffc') !== triggerArg) return;
|
|
98
|
+
if (optionsArg.wordStart) {
|
|
99
|
+
if ($from.parent.type.spec.code || $from.marks().some((mark) => mark.type.name === 'code' || mark.type.name === 'link')) return;
|
|
100
|
+
const start = $from.parentOffset - triggerArg.length;
|
|
101
|
+
const before = start ? $from.parent.textBetween(start - 1, start, '', '\ufffc') : '';
|
|
102
|
+
if (before && !/[\s\p{Ps}\p{Pi}\ufffc]/u.test(before)) return;
|
|
103
|
+
}
|
|
104
|
+
this.range = { from: from - triggerArg.length, to };
|
|
105
|
+
void this.open();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public async close(restoreFocusArg: boolean): Promise<void> {
|
|
109
|
+
const popup = this.popup;
|
|
110
|
+
const editor = this.host.editor();
|
|
111
|
+
const opening = this.opening;
|
|
112
|
+
this.popup = undefined;
|
|
113
|
+
this.range = undefined;
|
|
114
|
+
if (!popup) return;
|
|
115
|
+
await opening?.catch(() => undefined);
|
|
116
|
+
await popup.hide();
|
|
117
|
+
if (restoreFocusArg && this.host.element.isConnected && !this.host.disabled() && this.host.editor() === editor) editor?.commands.focus();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private position(): void {
|
|
121
|
+
const editor = this.host.editor();
|
|
122
|
+
if (!editor || !this.popup || !this.range) return;
|
|
123
|
+
const coords = editor.view.coordsAtPos(this.range.to);
|
|
124
|
+
// The text around the caret, which a scroll in the editor moves along
|
|
125
|
+
const { node } = editor.view.domAtPos(this.range.to);
|
|
126
|
+
this.popup.triggerElement = node instanceof HTMLElement ? node : node.parentElement;
|
|
127
|
+
this.popup.triggerRect = new DOMRect(coords.left, coords.top, 340, coords.bottom - coords.top);
|
|
128
|
+
this.popup.opensToTop = window.innerHeight - coords.bottom < 300 && coords.top > window.innerHeight - coords.bottom;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private async open(): Promise<void> {
|
|
132
|
+
const popup = (this.popup = new DeesInputDropdownPopup());
|
|
133
|
+
popup.ownerComponent = this.host.element;
|
|
134
|
+
popup.searchLabel = this.host.searchLabel();
|
|
135
|
+
provideOverlayI18n(popup, { i18n: this.host.i18n() });
|
|
136
|
+
popup.searchOptions = async (query, signal) =>
|
|
137
|
+
(await this.host.search()!(query, signal)).map((reference) => ({ key: reference.id, option: reference.label, payload: reference }));
|
|
138
|
+
this.position();
|
|
139
|
+
popup.addEventListener('reposition-request', () => this.position());
|
|
140
|
+
popup.addEventListener('close-request', () => {
|
|
141
|
+
void this.close(true);
|
|
142
|
+
});
|
|
143
|
+
popup.addEventListener('keydown', (event: KeyboardEvent) => {
|
|
144
|
+
if (event.key === 'Tab') {
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
void this.close(true);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
popup.addEventListener('option-selected', (event: Event) => {
|
|
150
|
+
const { id, label } = (event as CustomEvent<{ payload: IInputReference }>).detail.payload;
|
|
151
|
+
const range = this.range;
|
|
152
|
+
const editor = this.host.editor();
|
|
153
|
+
if (range && editor && !this.host.disabled()) {
|
|
154
|
+
editor.chain().setMeta(referenceInsertMeta, true).insertContentAt(range, [
|
|
155
|
+
{ type: referenceType, attrs: { id, label } },
|
|
156
|
+
{ type: 'text', text: ' ' },
|
|
157
|
+
]).run();
|
|
158
|
+
}
|
|
159
|
+
void this.close(true);
|
|
160
|
+
});
|
|
161
|
+
this.opening = popup.show();
|
|
162
|
+
try {
|
|
163
|
+
await this.opening;
|
|
164
|
+
this.host.opened();
|
|
165
|
+
if (this.popup === popup && this.host.element.isConnected && !this.host.disabled()) await popup.focusSearchInput();
|
|
166
|
+
} catch (error) {
|
|
167
|
+
this.host.failed(error);
|
|
168
|
+
void this.close(false);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -255,6 +255,28 @@ export const richtextStyles = [
|
|
|
255
255
|
color: color-mix(in srgb, var(--dees-color-link) 80%, var(--dees-color-text-primary));
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/* A reference to a record: read-only, reached and opened like a link. */
|
|
259
|
+
.editor-content .ProseMirror [data-reference-id] {
|
|
260
|
+
padding: 1px 5px;
|
|
261
|
+
border-radius: var(--dees-radius-sm);
|
|
262
|
+
color: var(--dees-color-link);
|
|
263
|
+
background: var(--dees-color-fill-tertiary);
|
|
264
|
+
font-weight: 500;
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.editor-content .ProseMirror [data-reference-id]:focus-visible,
|
|
269
|
+
.editor-content .ProseMirror [data-reference-id].ProseMirror-selectednode {
|
|
270
|
+
outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
|
|
271
|
+
outline-offset: 1px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.reference-error {
|
|
275
|
+
margin: 4px var(--richtext-inset-inline, 0px) 0;
|
|
276
|
+
color: var(--dees-color-text-error);
|
|
277
|
+
font-size: var(--dees-font-footnote-size);
|
|
278
|
+
}
|
|
279
|
+
|
|
258
280
|
/* Markdown the editor does not offer, kept as written: its source, read-only. */
|
|
259
281
|
.editor-content .ProseMirror .markdown-kept {
|
|
260
282
|
font-family: var(--dees-font-family-mono);
|
|
@@ -29,6 +29,7 @@ export const renderRichtext = (component: DeesInputRichtext): TemplateResult =>
|
|
|
29
29
|
`
|
|
30
30
|
: ''}
|
|
31
31
|
</dees-tile>
|
|
32
|
+
${component.referenceError ? html`<p class="reference-error" role="alert">${component.referenceError}</p>` : ''}
|
|
32
33
|
${component.renderDescription()}
|
|
33
34
|
</div>
|
|
34
35
|
`;
|
|
@@ -823,6 +823,8 @@ export class DeesKanban extends DeesElement {
|
|
|
823
823
|
this.detail.showTicketKey = false;
|
|
824
824
|
// The modal's flush body owns the surface; the detail lines up with its heading.
|
|
825
825
|
this.detail.frameless = true;
|
|
826
|
+
// The discussion's pinned composer is opaque in that surface.
|
|
827
|
+
this.detail.style.setProperty('--dees-kanban-detail-surface', 'var(--dees-material-thick-bg-opaque)');
|
|
826
828
|
for (const name of interactionEvents) this.detail.addEventListener(name, this.handleInteraction);
|
|
827
829
|
}
|
|
828
830
|
this.detail.ticket = ticket;
|
|
@@ -883,6 +885,9 @@ export class DeesKanban extends DeesElement {
|
|
|
883
885
|
];
|
|
884
886
|
this.detail.columns = this.columns;
|
|
885
887
|
this.detail.people = this.people;
|
|
888
|
+
this.detail.currentPerson = this.currentPersonId
|
|
889
|
+
? this.people.find(person => person.id === this.currentPersonId)
|
|
890
|
+
: undefined;
|
|
886
891
|
this.detail.provider = this.provider;
|
|
887
892
|
this.detail.searchTickets = this.searchTickets;
|
|
888
893
|
this.detail.projects = this.projects;
|
|
@@ -5,18 +5,23 @@ import {
|
|
|
5
5
|
html,
|
|
6
6
|
} from '@design.estate/dees-element';
|
|
7
7
|
import { dcLocalize } from '../../../i18n/localize.js';
|
|
8
|
-
import type { IKanbanComment, IKanbanProvider } from '../interfaces.js';
|
|
8
|
+
import type { IKanbanComment, IKanbanPerson, IKanbanProvider } from '../interfaces.js';
|
|
9
9
|
import { kanbanFeedStyles, kanbanStyles } from '../kanban.styles.js';
|
|
10
10
|
import { kanbanEvent } from '../kanban.helpers.js';
|
|
11
11
|
import type {
|
|
12
12
|
TReferenceContent,
|
|
13
13
|
TReferenceSearch,
|
|
14
14
|
} from '../../00group-input/dees-input-reference/index.js';
|
|
15
|
+
import {
|
|
16
|
+
markdownToReferences,
|
|
17
|
+
referencesToMarkdown,
|
|
18
|
+
} from '../../00group-input/dees-input-richtext/markdown.js';
|
|
15
19
|
import type {
|
|
16
20
|
IThreadDraftDetail,
|
|
17
21
|
IThreadEntry,
|
|
18
22
|
IThreadReferenceDetail,
|
|
19
23
|
IThreadSubmission,
|
|
24
|
+
TThreadView,
|
|
20
25
|
} from '../../00group-dataview/dees-thread/interfaces.js';
|
|
21
26
|
import '../../00group-button/dees-button/dees-button.js';
|
|
22
27
|
import '../../00group-dataview/dees-thread/dees-thread.js';
|
|
@@ -27,7 +32,12 @@ declare global {
|
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* A ticket's comments as a `dees-thread`: its Markdown composer links tickets by `#`, headed by the
|
|
37
|
+
* reader's avatar. Comments and the draft stay `TReferenceContent`, their text parts Markdown, and
|
|
38
|
+
* the events and the provider see them so. `view` shows the comments or the composer alone, as the
|
|
39
|
+
* ticket detail pins the composer under its main column.
|
|
40
|
+
*/
|
|
31
41
|
@customElement('dees-kanban-discussion')
|
|
32
42
|
export class DeesKanbanDiscussion extends DeesElement {
|
|
33
43
|
private readonly t = dcLocalize(this);
|
|
@@ -44,6 +54,14 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
44
54
|
@property({ attribute: false })
|
|
45
55
|
accessor searchTickets: TReferenceSearch | undefined;
|
|
46
56
|
|
|
57
|
+
/** The reader, whose avatar heads the composer. */
|
|
58
|
+
@property({ attribute: false })
|
|
59
|
+
accessor currentPerson: IKanbanPerson | undefined;
|
|
60
|
+
|
|
61
|
+
/** The comments with the composer at their end, or either alone; see `dees-thread`'s `view`. */
|
|
62
|
+
@property({ type: String, reflect: true })
|
|
63
|
+
accessor view: TThreadView = 'full';
|
|
64
|
+
|
|
47
65
|
@property({ attribute: false })
|
|
48
66
|
accessor addComment: IKanbanProvider['addComment'];
|
|
49
67
|
|
|
@@ -65,6 +83,9 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
65
83
|
/** The ticket's comments as the thread's entries, oldest first. */
|
|
66
84
|
private threadEntries: IThreadEntry[] = [];
|
|
67
85
|
|
|
86
|
+
/** The composer's Markdown the draft was read from, given back while the draft is unchanged. */
|
|
87
|
+
private draftSource: { draft: TReferenceContent; markdown: string } | undefined;
|
|
88
|
+
|
|
68
89
|
protected override willUpdate(changed: Map<string, unknown>): void {
|
|
69
90
|
super.willUpdate(changed);
|
|
70
91
|
if (!changed.has('comments') && !changed.has('ticketId')) return;
|
|
@@ -75,12 +96,16 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
75
96
|
id: comment.id,
|
|
76
97
|
author: { id: comment.author.id, name: comment.author.name },
|
|
77
98
|
createdAt: comment.createdAt,
|
|
78
|
-
body: comment.body,
|
|
99
|
+
body: referencesToMarkdown(comment.body),
|
|
79
100
|
}));
|
|
80
101
|
}
|
|
81
102
|
|
|
103
|
+
private threadDraft(): string {
|
|
104
|
+
return this.draftSource?.draft === this.draft ? this.draftSource.markdown : referencesToMarkdown(this.draft);
|
|
105
|
+
}
|
|
106
|
+
|
|
82
107
|
public render() {
|
|
83
|
-
return html`${this.showHeader
|
|
108
|
+
return html`${this.showHeader && this.view !== 'composer'
|
|
84
109
|
? html`<header>
|
|
85
110
|
<h3>${this.t('kanban.discussion')}</h3>
|
|
86
111
|
<span class="count">${this.threadEntries.length}</span>
|
|
@@ -98,12 +123,14 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
98
123
|
</header>`
|
|
99
124
|
: ''}
|
|
100
125
|
<dees-thread
|
|
101
|
-
format="references"
|
|
102
126
|
.threadId=${this.ticketId}
|
|
103
127
|
.entries=${this.threadEntries}
|
|
104
|
-
.
|
|
128
|
+
.currentUser=${this.currentPerson}
|
|
129
|
+
.draft=${this.threadDraft()}
|
|
105
130
|
.placeholder=${this.t('kanban.commentPlaceholder')}
|
|
106
131
|
.searchReferences=${this.searchTickets}
|
|
132
|
+
.referenceSearchLabel=${this.t('reference.search')}
|
|
133
|
+
.view=${this.view}
|
|
107
134
|
.onSubmit=${this.post}
|
|
108
135
|
.readOnly=${this.readOnly || !this.addComment || !this.ticketId}
|
|
109
136
|
.readOnlyReason=${this.t('kanban.readOnly')}
|
|
@@ -111,8 +138,10 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
111
138
|
.error=${this.error}
|
|
112
139
|
@thread-draft=${(event: CustomEvent<IThreadDraftDetail>) => {
|
|
113
140
|
event.stopPropagation();
|
|
114
|
-
|
|
115
|
-
|
|
141
|
+
const markdown = event.detail.body;
|
|
142
|
+
if (event.detail.threadId !== this.ticketId || typeof markdown !== 'string') return;
|
|
143
|
+
this.draft = markdownToReferences(markdown);
|
|
144
|
+
this.draftSource = { draft: this.draft, markdown };
|
|
116
145
|
kanbanEvent(this, 'kanban-comment-draft', { ticketId: this.ticketId, body: this.draft });
|
|
117
146
|
}}
|
|
118
147
|
@thread-reference-open=${(event: CustomEvent<IThreadReferenceDetail>) => {
|
|
@@ -138,8 +167,8 @@ export class DeesKanbanDiscussion extends DeesElement {
|
|
|
138
167
|
private readonly post = async ({ body }: IThreadSubmission): Promise<void> => {
|
|
139
168
|
const ticketId = this.ticketId;
|
|
140
169
|
const addComment = this.addComment;
|
|
141
|
-
if (!ticketId || !addComment ||
|
|
142
|
-
const submittedBody = body
|
|
170
|
+
if (!ticketId || !addComment || typeof body !== 'string') return;
|
|
171
|
+
const submittedBody = markdownToReferences(body);
|
|
143
172
|
const comment = await addComment({ ticketId, body: submittedBody });
|
|
144
173
|
if (comment.ticketId !== ticketId) throw new Error(this.t('kanban.commentMismatch'));
|
|
145
174
|
kanbanEvent(this, 'kanban-comment-added', { comment, submittedBody });
|
package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts
CHANGED
|
@@ -82,6 +82,10 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
82
82
|
@property({ attribute: false })
|
|
83
83
|
accessor people: IKanbanPerson[] = [];
|
|
84
84
|
|
|
85
|
+
/** The reader, whose avatar heads the discussion's composer. */
|
|
86
|
+
@property({ attribute: false })
|
|
87
|
+
accessor currentPerson: IKanbanPerson | undefined;
|
|
88
|
+
|
|
85
89
|
@property({ attribute: false })
|
|
86
90
|
accessor provider: IKanbanProvider = {};
|
|
87
91
|
|
|
@@ -163,6 +167,11 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
163
167
|
* The properties stand between the lead and the rest in the document, so on a phone, where
|
|
164
168
|
* they follow the title and the description, the focus order is the order on screen; beside
|
|
165
169
|
* the main column they are placed against the panes, outside its scroll.
|
|
170
|
+
*
|
|
171
|
+
* The discussion's composer stays at the foot of the main column, over the content scrolling
|
|
172
|
+
* beneath it, opaque in the detail's surface, --dees-kanban-detail-surface (the page's
|
|
173
|
+
* background unless the host sets its own). On a short ticket it rests at the bottom, and the
|
|
174
|
+
* space above it belongs to the conversation. On a phone it follows the discussion.
|
|
166
175
|
*/
|
|
167
176
|
:host {
|
|
168
177
|
display: grid;
|
|
@@ -178,6 +187,8 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
178
187
|
}
|
|
179
188
|
|
|
180
189
|
.main {
|
|
190
|
+
display: flex;
|
|
191
|
+
flex-direction: column;
|
|
181
192
|
height: 100%;
|
|
182
193
|
min-width: 0;
|
|
183
194
|
margin-right: 280px;
|
|
@@ -196,11 +207,31 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
196
207
|
min-width: 0;
|
|
197
208
|
}
|
|
198
209
|
|
|
210
|
+
/* It takes the height a short ticket leaves, so the composer rests at the bottom. */
|
|
199
211
|
.body {
|
|
212
|
+
flex-grow: 1;
|
|
200
213
|
min-width: 0;
|
|
201
214
|
margin-top: 24px;
|
|
202
215
|
}
|
|
203
216
|
|
|
217
|
+
/*
|
|
218
|
+
* Across the column and into its bottom padding, so that it meets the column's edges: the
|
|
219
|
+
* 24px are the column's right and bottom padding.
|
|
220
|
+
*/
|
|
221
|
+
.main > .composer {
|
|
222
|
+
position: sticky;
|
|
223
|
+
bottom: -24px;
|
|
224
|
+
z-index: 2;
|
|
225
|
+
margin: 24px -24px -24px calc(0px - var(--detail-inset-inline, 24px));
|
|
226
|
+
padding: 16px 24px 16px var(--detail-inset-inline, 24px);
|
|
227
|
+
border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
|
|
228
|
+
background: var(--dees-kanban-detail-surface, var(--dees-color-bg-primary));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.main > .composer[hidden] {
|
|
232
|
+
display: none;
|
|
233
|
+
}
|
|
234
|
+
|
|
204
235
|
.toolbar {
|
|
205
236
|
flex-wrap: nowrap;
|
|
206
237
|
min-width: 0;
|
|
@@ -717,6 +748,13 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
717
748
|
margin-top: 0;
|
|
718
749
|
padding-block: 20px 16px;
|
|
719
750
|
}
|
|
751
|
+
.main > .composer {
|
|
752
|
+
position: static;
|
|
753
|
+
margin: 0;
|
|
754
|
+
padding: 0 var(--detail-inset-inline, 16px) 16px;
|
|
755
|
+
border-top: 0;
|
|
756
|
+
background: none;
|
|
757
|
+
}
|
|
720
758
|
/* The band above already sets the discussion apart. */
|
|
721
759
|
.body > .discussion:first-child,
|
|
722
760
|
.body > .feed:first-child {
|
|
@@ -876,6 +914,11 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
876
914
|
private addComment = (input: Parameters<NonNullable<IKanbanProvider['addComment']>>[0]) =>
|
|
877
915
|
this.provider.addComment!(input);
|
|
878
916
|
|
|
917
|
+
/** Keeps the comment the reader is writing, so that the next render gives the composer it back, not an older one. */
|
|
918
|
+
private keepCommentDraft = (event: CustomEvent<{ ticketId: string; body: TReferenceContent }>) => {
|
|
919
|
+
if (event.detail.ticketId === this.ticket?.id) this.commentDraft = event.detail.body;
|
|
920
|
+
};
|
|
921
|
+
|
|
879
922
|
public render() {
|
|
880
923
|
const ticket = this.ticket;
|
|
881
924
|
if (!ticket) return html``;
|
|
@@ -1185,23 +1228,38 @@ export class DeesKanbanTicketDetail extends DeesElement {
|
|
|
1185
1228
|
: ''}
|
|
1186
1229
|
${this.provider.loadActivity ? this.renderFeed(ticket) : this.renderDiscussion(ticket)}
|
|
1187
1230
|
</div>
|
|
1231
|
+
${this.renderComposer(ticket)}
|
|
1188
1232
|
</div>
|
|
1189
1233
|
</div>`;
|
|
1190
1234
|
}
|
|
1191
1235
|
|
|
1236
|
+
/** The discussion's comments; its composer is pinned apart, under the main column. */
|
|
1192
1237
|
private renderDiscussion(ticket: IKanbanTicket, inFeed = false): TemplateResult {
|
|
1193
1238
|
return html`<dees-kanban-discussion
|
|
1194
1239
|
class=${inFeed ? '' : 'discussion'}
|
|
1240
|
+
.view=${'entries'}
|
|
1195
1241
|
.ticketId=${ticket.id}
|
|
1196
1242
|
.comments=${this.comments}
|
|
1197
|
-
.draft=${this.commentDraft}
|
|
1198
1243
|
.loading=${this.loadingComments}
|
|
1199
1244
|
.error=${this.commentsError}
|
|
1245
|
+
.showHeader=${!inFeed}
|
|
1246
|
+
?hidden=${inFeed && this.feed !== 'comments'}
|
|
1247
|
+
></dees-kanban-discussion>`;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/** The discussion's composer, pinned under the main column; the history hides it, keeping its draft. */
|
|
1251
|
+
private renderComposer(ticket: IKanbanTicket): TemplateResult {
|
|
1252
|
+
return html`<dees-kanban-discussion
|
|
1253
|
+
class="composer"
|
|
1254
|
+
.view=${'composer'}
|
|
1255
|
+
.ticketId=${ticket.id}
|
|
1256
|
+
.draft=${this.commentDraft}
|
|
1200
1257
|
.readOnly=${ticket.permissions?.comment === false}
|
|
1201
1258
|
.searchTickets=${this.searchTickets}
|
|
1259
|
+
.currentPerson=${this.currentPerson}
|
|
1202
1260
|
.addComment=${this.provider.addComment ? this.addComment : undefined}
|
|
1203
|
-
|
|
1204
|
-
|
|
1261
|
+
?hidden=${!!this.provider.loadActivity && this.feed !== 'comments'}
|
|
1262
|
+
@kanban-comment-draft=${this.keepCommentDraft}
|
|
1205
1263
|
></dees-kanban-discussion>`;
|
|
1206
1264
|
}
|
|
1207
1265
|
|
|
@@ -239,7 +239,7 @@ export const createKanbanDemo = (options: IKanbanDemoOptions = {}): IKanbanDemo
|
|
|
239
239
|
key: 'CAT-102',
|
|
240
240
|
kind: 'task',
|
|
241
241
|
title: 'Connect related tickets',
|
|
242
|
-
description: 'Type #
|
|
242
|
+
description: 'Type # in a comment to search for another ticket. Keep the reference connected when its title changes.',
|
|
243
243
|
parentId: 'epic-2',
|
|
244
244
|
columnId: 'progress',
|
|
245
245
|
order: 0,
|
package/ts_web/i18n/de.ts
CHANGED
|
@@ -509,6 +509,7 @@ export default dcMessages.translation('de', {
|
|
|
509
509
|
'richtext.redo': 'Wiederholen (Strg+Y)',
|
|
510
510
|
'richtext.urlPlaceholder': 'URL eingeben …',
|
|
511
511
|
'richtext.url': 'Linkadresse',
|
|
512
|
+
'richtext.referenceSearch': 'Suchen und verknüpfen',
|
|
512
513
|
'richtext.kept': 'Unverändert übernommen',
|
|
513
514
|
'richtext.words': '{count, plural, one {# Wort} other {# Wörter}}',
|
|
514
515
|
|
|
@@ -900,7 +901,7 @@ export default dcMessages.translation('de', {
|
|
|
900
901
|
'kanban.noChildren': '{kind, select, epic {Noch keine Aufgaben.} task {Noch keine Teilaufgaben.} other {Noch keine Teilaufgaben.}}',
|
|
901
902
|
'kanban.discussion': 'Diskussion',
|
|
902
903
|
'kanban.refresh': 'Aktualisieren',
|
|
903
|
-
'kanban.commentPlaceholder': 'Kommentar schreiben – mit #
|
|
904
|
+
'kanban.commentPlaceholder': 'Kommentar schreiben – mit # ein Ticket verknüpfen',
|
|
904
905
|
'kanban.readOnly': 'Kommentare sind schreibgeschützt.',
|
|
905
906
|
'kanban.commentMismatch': 'Der gespeicherte Kommentar gehört zu einem anderen Ticket.',
|
|
906
907
|
'kanban.activityMismatch': 'Der Verlauf gehört zu einem anderen Ticket.',
|
package/ts_web/i18n/messages.ts
CHANGED
|
@@ -535,6 +535,7 @@ export const dcMessages = plugins.smarti18n.defineCatalog({
|
|
|
535
535
|
'richtext.redo': { message: 'Redo (Ctrl+Y)', description: 'Toolbar button, with its shortcut.' },
|
|
536
536
|
'richtext.urlPlaceholder': { message: 'Enter URL...', description: 'The link field\'s placeholder.' },
|
|
537
537
|
'richtext.url': { message: 'Link address', description: 'The link field\'s name.' },
|
|
538
|
+
'richtext.referenceSearch': { message: 'Search to link', description: 'The search typing the reference trigger (#) opens in a text, for a record to link.' },
|
|
538
539
|
'richtext.kept': { message: 'Kept as written', description: 'The tooltip of Markdown the editor does not offer, such as a table or an image: shown as written and saved unchanged.' },
|
|
539
540
|
'richtext.words': { message: '{count, plural, one {# word} other {# words}}', description: 'The word count in the footer.' },
|
|
540
541
|
|
|
@@ -934,7 +935,7 @@ export const dcMessages = plugins.smarti18n.defineCatalog({
|
|
|
934
935
|
'kanban.noChildren': { message: '{kind, select, epic {No tasks yet.} task {No subtasks yet.} other {No subtasks yet.}}', description: 'Said by a ticket without child tickets; {kind} is the ticket\'s kind.' },
|
|
935
936
|
'kanban.discussion': { message: 'Discussion', description: 'The heading over a ticket\'s comments.' },
|
|
936
937
|
'kanban.refresh': { message: 'Refresh', description: 'The button that loads a ticket\'s comments again.' },
|
|
937
|
-
'kanban.commentPlaceholder': { message: 'Write a comment — type #
|
|
938
|
+
'kanban.commentPlaceholder': { message: 'Write a comment — type # to link a ticket', description: 'The comment field\'s placeholder; keep #, the character that links a ticket.' },
|
|
938
939
|
'kanban.readOnly': { message: 'Comments are read-only.', description: 'Said in place of the comment field when the reader cannot comment.' },
|
|
939
940
|
'kanban.commentMismatch': { message: 'The saved comment belongs to a different ticket.', description: 'Said when the host saved a comment to another ticket.' },
|
|
940
941
|
'kanban.activityMismatch': { message: 'The history belongs to a different ticket.', description: 'Said when the host answered a ticket\'s history with another ticket\'s entries.' },
|
|
@@ -11,9 +11,17 @@
|
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
13
|
* `dees-input-richtext` reads and writes its value with these same functions in `format="markdown"`.
|
|
14
|
+
*
|
|
15
|
+
* A reference to a record is a link to `#reference:` and its id (`richtextReferenceHref`,
|
|
16
|
+
* `richtextReferenceId`); a host that keeps a text's references as records reads Markdown as text and references
|
|
17
|
+
* and writes them back (`richtextMarkdownToReferences`, `richtextReferencesToMarkdown`).
|
|
14
18
|
*/
|
|
15
19
|
export {
|
|
16
20
|
richtextMarkdownRenderOptions,
|
|
17
21
|
markdownToDoc as richtextMarkdownToDoc,
|
|
18
22
|
docToMarkdown as richtextDocToMarkdown,
|
|
23
|
+
referenceHref as richtextReferenceHref,
|
|
24
|
+
referenceId as richtextReferenceId,
|
|
25
|
+
markdownToReferences as richtextMarkdownToReferences,
|
|
26
|
+
referencesToMarkdown as richtextReferencesToMarkdown,
|
|
19
27
|
} from './elements/00group-input/dees-input-richtext/markdown.js';
|