From 9d6c7f8100de3a952d20ad41ab20872737cb909e Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 27 Aug 2023 20:25:55 -0400
Subject: lots of cleanup to streamline import orderings (ie packages should
not mutually import each other directly or via a chain). change
raiseWhenDragged to be keepZWhenDragged and got rid of system wide default.
---
.../views/nodes/formattedText/FormattedTextBox.tsx | 24 ++++++++++++++--------
1 file changed, 15 insertions(+), 9 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 200d06a0b..bd969b527 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -11,9 +11,10 @@ import { keymap } from 'prosemirror-keymap';
import { Fragment, Mark, Node, Slice } from 'prosemirror-model';
import { EditorState, NodeSelection, Plugin, TextSelection, Transaction } from 'prosemirror-state';
import { EditorView } from 'prosemirror-view';
+import { BsMarkdownFill } from 'react-icons/bs';
import { DateField } from '../../../../fields/DateField';
-import { Doc, DocListCast, StrListCast, Field, Opt } from '../../../../fields/Doc';
-import { AclAdmin, AclAugment, AclEdit, AclSelfEdit, DocCss, Height, Width, ForceServerWrite, UpdatingFromServer } from '../../../../fields/DocSymbols';
+import { Doc, DocListCast, Field, Opt } from '../../../../fields/Doc';
+import { AclAdmin, AclAugment, AclEdit, AclSelfEdit, DocCss, ForceServerWrite, Height, UpdatingFromServer, Width } from '../../../../fields/DocSymbols';
import { Id } from '../../../../fields/FieldSymbols';
import { InkTool } from '../../../../fields/InkField';
import { List } from '../../../../fields/List';
@@ -25,11 +26,10 @@ import { BoolCast, Cast, DocCast, FieldValue, NumCast, ScriptCast, StrCast } fro
import { GetEffectiveAcl, TraceMobx } from '../../../../fields/util';
import { addStyleSheet, addStyleSheetRule, clearStyleSheetRules, emptyFunction, numberRange, returnFalse, returnZero, setupMoveUpEvents, smoothScroll, unimplementedFunction, Utils } from '../../../../Utils';
import { GoogleApiClientUtils, Pulls, Pushes } from '../../../apis/google_docs/GoogleApiClientUtils';
-import { gptAPICall, GPTCallType, gptImageCall } from '../../../apis/gpt/GPT';
+import { gptAPICall, GPTCallType } from '../../../apis/gpt/GPT';
import { DocServer } from '../../../DocServer';
import { Docs, DocUtils } from '../../../documents/Documents';
-import { CollectionViewType, DocumentType } from '../../../documents/DocumentTypes';
-import { Networking } from '../../../Network';
+import { CollectionViewType } from '../../../documents/DocumentTypes';
import { DictationManager } from '../../../util/DictationManager';
import { DocumentManager } from '../../../util/DocumentManager';
import { DragManager } from '../../../util/DragManager';
@@ -49,6 +49,7 @@ import { DocumentButtonBar } from '../../DocumentButtonBar';
import { Colors } from '../../global/globalEnums';
import { LightboxView } from '../../LightboxView';
import { AnchorMenu } from '../../pdf/AnchorMenu';
+import { GPTPopup } from '../../pdf/GPTPopup/GPTPopup';
import { SidebarAnnos } from '../../SidebarAnnos';
import { StyleProp } from '../../StyleProvider';
import { DocFocusOptions, DocumentView, DocumentViewInternal, OpenWhere } from '../DocumentView';
@@ -70,8 +71,6 @@ import { schema } from './schema_rts';
import { SummaryView } from './SummaryView';
import applyDevTools = require('prosemirror-dev-tools');
import React = require('react');
-import { GPTPopup, GPTPopupMode } from '../../pdf/GPTPopup/GPTPopup';
-import { BsMarkdownFill } from 'react-icons/bs';
const translateGoogleApi = require('translate-google-api');
export const GoogleRef = 'googleDocId';
type PullHandler = (exportState: Opt, dataDoc: Doc) => void;
@@ -575,7 +574,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent DocumentManager.Instance.RecordingEvent, this.breakupDictation);
+ this._disposers.breakupDictation = reaction(() => Doc.RecordingEvent, this.breakupDictation);
this._disposers.layout_autoHeight = reaction(
() => this.layout_autoHeight,
layout_autoHeight => layout_autoHeight && this.tryUpdateScrollHeight()
--
cgit v1.2.3-70-g09d2
From 275e6e699c2fe7665dbe05aeb58fca9337271f28 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 4 Sep 2023 12:33:32 -0400
Subject: fixed undoing highlighting text.
---
src/client/views/nodes/formattedText/FormattedTextBox.tsx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index bd969b527..c9481482f 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -38,7 +38,7 @@ import { LinkManager } from '../../../util/LinkManager';
import { RTFMarkup } from '../../../util/RTFMarkup';
import { SelectionManager } from '../../../util/SelectionManager';
import { SnappingManager } from '../../../util/SnappingManager';
-import { undoBatch, UndoManager } from '../../../util/UndoManager';
+import { undoable, undoBatch, UndoManager } from '../../../util/UndoManager';
import { CollectionFreeFormView } from '../../collections/collectionFreeForm/CollectionFreeFormView';
import { CollectionStackingView } from '../../collections/CollectionStackingView';
import { CollectionTreeView } from '../../collections/CollectionTreeView';
@@ -274,10 +274,13 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
- this._editorView?.state && RichTextMenu.Instance.setHighlight(color);
- return undefined;
- });
+ AnchorMenu.Instance.Highlight = undoable(
+ action((color: string, isLinkButton: boolean) => {
+ this._editorView?.state && RichTextMenu.Instance.setHighlight(color);
+ return undefined;
+ }),
+ 'highlght text'
+ );
AnchorMenu.Instance.onMakeAnchor = () => this.getAnchor(true);
AnchorMenu.Instance.StartCropDrag = unimplementedFunction;
/**
--
cgit v1.2.3-70-g09d2
From 34a29cccdb65c6e2d4b1b4fd83c78a70cdfcb686 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 4 Sep 2023 15:54:22 -0400
Subject: improved setting font size on lists.
---
.../views/nodes/formattedText/RichTextMenu.tsx | 29 ++++++++++++++++------
1 file changed, 21 insertions(+), 8 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/RichTextMenu.tsx b/src/client/views/nodes/formattedText/RichTextMenu.tsx
index 9c46459b0..e3ac4fb9d 100644
--- a/src/client/views/nodes/formattedText/RichTextMenu.tsx
+++ b/src/client/views/nodes/formattedText/RichTextMenu.tsx
@@ -21,6 +21,7 @@ import { updateBullets } from './ProsemirrorExampleTransfer';
import './RichTextMenu.scss';
import { schema } from './schema_rts';
import { EquationBox } from '../EquationBox';
+import { numberRange } from '../../../../Utils';
const { toggleMark } = require('prosemirror-commands');
@observer
@@ -149,19 +150,31 @@ export class RichTextMenu extends AntimodeMenu {
setMark = (mark: Mark, state: EditorState, dispatch: any, dontToggle: boolean = false) => {
if (mark) {
- const node = (state.selection as NodeSelection).node;
+ const liFirst = numberRange(state.selection.$from.depth + 1).find(i => state.selection.$from.node(i)?.type === state.schema.nodes.list_item);
+ const liTo = numberRange(state.selection.$to.depth + 1).find(i => state.selection.$to.node(i)?.type === state.schema.nodes.list_item);
+ const olFirst = numberRange(state.selection.$from.depth + 1).find(i => state.selection.$from.node(i)?.type === state.schema.nodes.ordered_list);
+ const nodeOl = (liFirst && liTo && state.selection.$from.node(liFirst) !== state.selection.$to.node(liTo) && olFirst) || (!liFirst && !liTo && olFirst);
+ const newPos = nodeOl ? numberRange(state.selection.from).findIndex(i => state.doc.nodeAt(i)?.type === state.schema.nodes.ordered_list) : state.selection.from;
+ const node = (state.selection as NodeSelection).node ?? (newPos >= 0 ? state.doc.nodeAt(newPos) : undefined);
if (node?.type === schema.nodes.ordered_list) {
let attrs = node.attrs;
if (mark.type === schema.marks.pFontFamily) attrs = { ...attrs, fontFamily: mark.attrs.family };
if (mark.type === schema.marks.pFontSize) attrs = { ...attrs, fontSize: mark.attrs.fontSize };
if (mark.type === schema.marks.pFontColor) attrs = { ...attrs, fontColor: mark.attrs.color };
- const tr = updateBullets(state.tr.setNodeMarkup(state.selection.from, node.type, attrs), state.schema);
- dispatch(tr.setSelection(new NodeSelection(tr.doc.resolve(state.selection.from))));
- } else if (dontToggle) {
- const tr = state.tr.addMark(state.selection.from, state.selection.to, mark);
- dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(state.selection.from), tr.doc.resolve(state.selection.to)))); // bcz: need to redo the selection because ctrl-a selections disappear otherwise
- } else {
- toggleMark(mark.type, mark.attrs)(state, dispatch);
+ const tr = updateBullets(state.tr.setNodeMarkup(newPos, node.type, attrs), state.schema);
+ dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(state.selection.from), tr.doc.resolve(state.selection.to))));
+ }
+ {
+ const state = this.view?.state;
+ const tr = this.view?.state.tr;
+ if (tr && state) {
+ if (dontToggle) {
+ tr.addMark(state.selection.from, state.selection.to, mark);
+ dispatch(tr.setSelection(new TextSelection(tr.doc.resolve(state.selection.from), tr.doc.resolve(state.selection.to)))); // bcz: need to redo the selection because ctrl-a selections disappear otherwise
+ } else {
+ toggleMark(mark.type, mark.attrs)(state, dispatch);
+ }
+ }
}
}
};
--
cgit v1.2.3-70-g09d2
From dc92e167391988b63e3ff15e67bcfad6df21c044 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Wed, 6 Sep 2023 13:53:32 -0400
Subject: fixed up audio annotation to add dictation to sidebar note.
---
src/client/util/SearchUtil.ts | 4 +-
src/client/views/StyleProvider.tsx | 2 +-
src/client/views/global/globalScripts.ts | 4 +-
src/client/views/nodes/DocumentView.tsx | 33 +++++++++++------
.../views/nodes/formattedText/FormattedTextBox.tsx | 43 +++++++++++++++-------
src/client/views/pdf/AnchorMenu.tsx | 18 ++++-----
src/fields/Doc.ts | 2 +
src/fields/DocSymbols.ts | 1 +
8 files changed, 67 insertions(+), 40 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts
index 64aa7ba9b..560d6b30f 100644
--- a/src/client/util/SearchUtil.ts
+++ b/src/client/util/SearchUtil.ts
@@ -57,8 +57,8 @@ export namespace SearchUtil {
const hlights = new Set();
SearchUtil.documentKeys(doc).forEach(
key =>
- Field.toString(doc[key] as Field)
- .toLowerCase()
+ (Field.toString(doc[key] as Field) + Field.toScriptString(doc[key] as Field))
+ .toLowerCase() //
.includes(query) && hlights.add(key)
);
blockedKeys.forEach(key => hlights.delete(key));
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index a9e4ac17d..cdf104a18 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -295,7 +295,7 @@ export function DefaultStyleProvider(doc: Opt, props: Opt {
const audioAnnoState = (doc: Doc) => StrCast(doc.audioAnnoState, 'stopped');
const audioAnnosCount = (doc: Doc) => StrListCast(doc[Doc.LayoutFieldKey(doc) + '_audioAnnotations']).length;
- if (!doc || props?.renderDepth === -1 || (!audioAnnosCount(doc) && audioAnnoState(doc) === 'stopped')) return null;
+ if (!doc || props?.renderDepth === -1 || !audioAnnosCount(doc)) return null;
const audioIconColors: { [key: string]: string } = { recording: 'red', playing: 'green', stopped: 'blue' };
return (
{StrListCast(doc[Doc.LayoutFieldKey(doc) + '_audioAnnotations_text']).lastElement()}}>
diff --git a/src/client/views/global/globalScripts.ts b/src/client/views/global/globalScripts.ts
index 38bf1042d..9b9cc6d24 100644
--- a/src/client/views/global/globalScripts.ts
+++ b/src/client/views/global/globalScripts.ts
@@ -182,8 +182,8 @@ ScriptingGlobals.add(function toggleCharStyle(charStyle: attrname, checkResult?:
toggle: () => editorView?.state && RichTextMenu.Instance.changeListType(list) }]);
// prettier-ignore
const attrs:attrfuncs[] = [
- ['dictation', { checkResult: () => textView?._recording ? true:false,
- toggle: () => textView && runInAction(() => (textView._recording = !textView._recording)) }],
+ ['dictation', { checkResult: () => textView?._recordingDictation ? true:false,
+ toggle: () => textView && runInAction(() => (textView._recordingDictation = !textView._recordingDictation)) }],
['noAutoLink',{ checkResult: () => (editorView ? RichTextMenu.Instance.noAutoLink : false),
toggle: () => editorView && RichTextMenu.Instance?.toggleNoAutoLinkAnchor()}],
['bold', { checkResult: () => (editorView ? RichTextMenu.Instance.bold : (Doc.UserDoc().fontWeight === 'bold') ? true:false),
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index ab99f3c6d..dcb2d9d51 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -4,7 +4,7 @@ import { observer } from 'mobx-react';
import { computedFn } from 'mobx-utils';
import { Bounce, Fade, Flip, LightSpeed, Roll, Rotate, Zoom } from 'react-reveal';
import { Doc, DocListCast, Field, Opt, StrListCast } from '../../../fields/Doc';
-import { AclPrivate, Animation, DocData, Width } from '../../../fields/DocSymbols';
+import { AclPrivate, Animation, AudioPlay, DocData, Width } from '../../../fields/DocSymbols';
import { Id } from '../../../fields/FieldSymbols';
import { InkTool } from '../../../fields/InkField';
import { List } from '../../../fields/List';
@@ -52,6 +52,7 @@ import { LinkAnchorBox } from './LinkAnchorBox';
import { PresEffect, PresEffectDirection } from './trails';
import { PinProps, PresBox } from './trails/PresBox';
import React = require('react');
+import { isThisTypeNode } from 'typescript';
const { Howl } = require('howler');
interface Window {
@@ -1054,7 +1055,7 @@ export class DocumentViewInternal extends DocComponent (dataDoc.audioAnnoState = 'recording'));
+ //runInAction(() => (dataDoc.audioAnnoState = 'recording'));
recorder.start();
const stopFunc = () => {
recorder.stop();
@@ -1071,16 +1072,24 @@ export class DocumentViewInternal extends DocComponent (self.dataDoc.audioAnnoState = 'stopped')),
- });
- this.dataDoc.audioAnnoState = 'playing';
+ if (anno instanceof AudioField) {
+ switch (audioAnnoState) {
+ case 'stopped':
+ this.dataDoc[AudioPlay] = new Howl({
+ src: [anno.url.href],
+ format: ['mp3'],
+ autoplay: true,
+ loop: false,
+ volume: 0.5,
+ onend: action(() => (self.dataDoc.audioAnnoState = 'stopped')),
+ });
+ this.dataDoc.audioAnnoState = 'playing';
+ break;
+ case 'playing':
+ this.dataDoc[AudioPlay]?.stop();
+ this.dataDoc.audioAnnoState = 'stopped';
+ break;
+ }
}
};
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index c9481482f..58b824159 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -153,10 +153,10 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
!this.layoutDoc.layout_showSidebar && this.toggleSidebar();
const anchor = this.makeLinkAnchor(undefined, OpenWhere.addRight, undefined, 'Anchored Selection', true, true);
+
setTimeout(() => {
const target = this._sidebarRef.current?.anchorMenuClick(anchor);
if (target) {
anchor.followLinkAudio = true;
- DocumentViewInternal.recordAudioAnnotation(Doc.GetProto(target), Doc.LayoutFieldKey(target));
+ let stopFunc: any;
+ Doc.GetProto(target).mediaState = 'recording';
+ Doc.GetProto(target).audioAnnoState = 'recording';
+ DocumentViewInternal.recordAudioAnnotation(Doc.GetProto(target), Doc.LayoutFieldKey(target), stop => (stopFunc = stop));
+ let reactionDisposer = reaction(
+ () => target.mediaState,
+ action(dictation => {
+ if (!dictation) {
+ Doc.GetProto(target).audioAnnoState = 'stopped';
+ stopFunc();
+ reactionDisposer();
+ }
+ })
+ );
target.title = ComputedField.MakeFunction(`self["text_audioAnnotations_text"].lastElement()`);
}
});
@@ -948,14 +962,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
- if (this._editorView && this._recording) {
+ if (this._editorView && this._recordingDictation) {
this.stopDictation(true);
this._break = true;
const state = this._editorView.state;
const to = state.selection.to;
const updated = TextSelection.create(state.doc, to, to);
this._editorView.dispatch(state.tr.setSelection(updated).insertText('\n', to));
- if (this._recording) {
+ if (this._recordingDictation) {
this.recordDictation();
}
}
@@ -1245,13 +1259,14 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent this._recording,
+ () => this._recordingDictation,
() => {
this.stopDictation(true);
- this._recording && this.recordDictation();
- }
+ this._recordingDictation && this.recordDictation();
+ },
+ { fireImmediately: true }
);
- if (this._recording) setTimeout(this.recordDictation);
+ if (this._recordingDictation) setTimeout(this.recordDictation);
}
var quickScroll: string | undefined = '';
this._disposers.scroll = reaction(
@@ -1549,8 +1564,8 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent disposer?.());
this.endUndoTypingBatch();
@@ -1588,7 +1603,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent
@@ -1899,7 +1914,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent (this._recording = !this._recording))
+ action(e => (this._recordingDictation = !this._recordingDictation))
)
}>
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index a52250145..85c1cce8c 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -132,7 +132,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip={'Click to Highlight'}
onClick={this.highlightClicked}
colorPicker={this.highlightColor}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
@@ -177,7 +177,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip="Summarize with AI" //
onPointerDown={this.gptSummarize}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
{AnchorMenu.Instance.OnAudio === unimplementedFunction ? null : (
@@ -185,7 +185,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip="Click to Record Annotation" //
onPointerDown={this.audioDown}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
{
type={Type.PRIM}
icon={}
popup={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
{AnchorMenu.Instance.StartCropDrag === unimplementedFunction ? null : (
@@ -201,7 +201,7 @@ export class AnchorMenu extends AntimodeMenu
{
tooltip="Click/Drag to create cropped image" //
onPointerDown={this.cropDown}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
@@ -213,7 +213,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip="Remove Link Anchor" //
onPointerDown={this.Delete}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
{this.PinToPres !== returnFalse && (
@@ -221,7 +221,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip="Pin to Presentation" //
onPointerDown={this.PinToPres}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
{this.ShowTargetTrail !== returnFalse && (
@@ -229,7 +229,7 @@ export class AnchorMenu extends AntimodeMenu {
tooltip="Show Linked Trail" //
onPointerDown={this.ShowTargetTrail}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
{this.IsTargetToggler !== returnFalse && (
@@ -240,7 +240,7 @@ export class AnchorMenu extends AntimodeMenu {
toggleStatus={this.IsTargetToggler()}
onClick={this.MakeTargetToggle}
icon={}
- color={StrCast(Doc.UserDoc().userColor)}
+ color={SettingsManager.userColor}
/>
)}
>
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 2a1dfbfc7..dd3f11444 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -20,6 +20,7 @@ import {
AclPrivate,
AclReadonly,
Animation,
+ AudioPlay,
CachedUpdates,
DirectLinks,
DocAcl,
@@ -349,6 +350,7 @@ export class Doc extends RefField {
@observable public [DocAcl]: { [key: string]: symbol } = {};
@observable public [DocCss]: number = 0; // incrementer denoting a change to CSS layout
@observable public [DirectLinks] = new ObservableSet();
+ @observable public [AudioPlay]: any; // meant to store sound object from Howl
@observable public [Animation]: Opt;
@observable public [Highlight]: boolean = false;
static __Anim(Doc: Doc) {
diff --git a/src/fields/DocSymbols.ts b/src/fields/DocSymbols.ts
index 5b743f710..bb974ee74 100644
--- a/src/fields/DocSymbols.ts
+++ b/src/fields/DocSymbols.ts
@@ -3,6 +3,7 @@ export const Self = Symbol('DocSelf');
export const SelfProxy = Symbol('DocSelfProxy');
export const FieldKeys = Symbol('DocFieldKeys');
export const FieldTuples = Symbol('DocFieldTuples');
+export const AudioPlay = Symbol('DocAudioPlay');
export const Width = Symbol('DocWidth');
export const Height = Symbol('DocHeight');
export const Animation = Symbol('DocAnimation');
--
cgit v1.2.3-70-g09d2
From e847215964bc02cf402eace30d6c9e19f5f0f0cf Mon Sep 17 00:00:00 2001
From: bobzel
Date: Thu, 7 Sep 2023 01:28:27 -0400
Subject: truncate link descriptions over link lines. Fix schema view issues
with multiline inputs. fix '#' field assignment for title bar of docs.
fixed dashFieldView to read fields from texstbox by fixing FindDocByTitle to
not match undefind. Don't end link_description input on Enter to allow
multiline inputs.
---
src/client/DocServer.ts | 8 +++--
src/client/views/EditableView.scss | 4 ++-
src/client/views/EditableView.tsx | 40 +++++++++++-----------
src/client/views/PropertiesView.tsx | 8 ++---
.../CollectionFreeFormLinkView.tsx | 4 +--
.../collectionLinear/CollectionLinearView.tsx | 10 +++---
src/client/views/linking/LinkMenuItem.tsx | 2 +-
src/client/views/nodes/DocumentView.tsx | 5 ++-
.../views/nodes/formattedText/RichTextRules.ts | 2 +-
9 files changed, 42 insertions(+), 41 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 5fdea131b..fc8a9f3d6 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -32,9 +32,11 @@ export namespace DocServer {
let _cache: { [id: string]: RefField | Promise> } = {};
export function FindDocByTitle(title: string) {
- const foundDocId = Array.from(Object.keys(_cache))
- .filter(key => _cache[key] instanceof Doc)
- .find(key => (_cache[key] as Doc).title === title);
+ const foundDocId =
+ title &&
+ Array.from(Object.keys(_cache))
+ .filter(key => _cache[key] instanceof Doc)
+ .find(key => (_cache[key] as Doc).title === title);
return foundDocId ? (_cache[foundDocId] as Doc) : undefined;
}
diff --git a/src/client/views/EditableView.scss b/src/client/views/EditableView.scss
index 0955ba8ff..f7c03caf9 100644
--- a/src/client/views/EditableView.scss
+++ b/src/client/views/EditableView.scss
@@ -3,7 +3,8 @@
overflow-wrap: break-word;
word-wrap: break-word;
hyphens: auto;
- overflow: hidden;
+ overflow: auto;
+ height: 100%;
min-width: 20;
text-overflow: ellipsis;
}
@@ -11,6 +12,7 @@
.editableView-container-editing-oneLine {
width: 100%;
height: max-content;
+ overflow: hidden;
span {
p {
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 147921596..ca4ffaf3a 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -231,7 +231,7 @@ export class EditableView extends React.Component {
onChange: this.props.autosuggestProps.onChange,
}}
/>
- ) : (
+ ) : this.props.oneLine !== false && this.props.GetValue()?.toString().indexOf('\n') === -1 ? (
(this._inputref = r)}
@@ -247,31 +247,31 @@ export class EditableView extends React.Component {
onClick={this.stopPropagation}
onPointerUp={this.stopPropagation}
/>
+ ) : (
+
- {!this.props.linkDoc.link_description ? null : {StrCast(this.props.linkDoc.link_description)}
}
+ {!this.props.linkDoc.link_description ? null : {StrCast(this.props.linkDoc.link_description).split('\n')[0].substring(0, 50)}
}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index dcb2d9d51..ae9977d7a 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1149,14 +1149,13 @@ export class DocumentViewInternal extends DocComponent
{
- this.props.select(false);
return showTitle.split(';').length === 1 ? showTitle + '=' + Field.toString(targetDoc[showTitle.split(';')[0]] as any as Field) : '#' + showTitle;
}}
SetValue={undoBatch((input: string) => {
if (input?.startsWith('#')) {
- if (this.props.layout_showTitle) {
+ if (this.rootDoc.layout_showTitle) {
this.rootDoc._layout_showTitle = input?.substring(1) ? input.substring(1) : undefined;
- } else {
+ } else if (!this.props.layout_showTitle) {
Doc.UserDoc().layout_showTitle = input?.substring(1) ? input.substring(1) : 'author_date';
}
} else {
diff --git a/src/client/views/nodes/formattedText/RichTextRules.ts b/src/client/views/nodes/formattedText/RichTextRules.ts
index 8bafc2cef..5d92f63ef 100644
--- a/src/client/views/nodes/formattedText/RichTextRules.ts
+++ b/src/client/views/nodes/formattedText/RichTextRules.ts
@@ -279,7 +279,7 @@ export class RichTextRules {
const num = value.match(/^[0-9.]$/);
this.Document[DocData][fieldKey] = value === 'true' ? true : value === 'false' ? false : num ? Number(value) : value;
}
- const target = DocServer.FindDocByTitle(docTitle);
+ const target = DocServer.FindDocByTitle(docTitle) ?? this.Document;
if (target) {
const fieldView = state.schema.nodes.dashField.create({ fieldKey, docId: target[Id], hideKey: false });
return state.tr.setSelection(new TextSelection(state.doc.resolve(start), state.doc.resolve(end))).replaceSelectionWith(fieldView, true);
--
cgit v1.2.3-70-g09d2
From 7bc82b283bc7aa11a163c95607a6e192439bd601 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Fri, 8 Sep 2023 10:10:09 -0400
Subject: added cancel trim and revert buttons to audiobox
---
src/client/documents/Documents.ts | 4 +-
src/client/views/SidebarAnnos.tsx | 1 -
src/client/views/collections/CollectionMenu.tsx | 3 +-
.../collections/CollectionStackedTimeline.tsx | 4 ++
src/client/views/nodes/AudioBox.tsx | 56 ++++++++++++++++++----
src/client/views/nodes/ScreenshotBox.tsx | 3 +-
.../views/nodes/formattedText/FormattedTextBox.tsx | 9 ++--
7 files changed, 63 insertions(+), 17 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index e413d4389..90c090f29 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -32,7 +32,7 @@ import { ContextMenu } from '../views/ContextMenu';
import { ContextMenuProps } from '../views/ContextMenuItem';
import { DFLT_IMAGE_NATIVE_DIM } from '../views/global/globalCssVariables.scss';
import { ActiveArrowEnd, ActiveArrowStart, ActiveDash, ActiveFillColor, ActiveInkBezierApprox, ActiveInkColor, ActiveInkWidth, ActiveIsInkMask, InkingStroke } from '../views/InkingStroke';
-import { AudioBox } from '../views/nodes/AudioBox';
+import { AudioBox, media_state } from '../views/nodes/AudioBox';
import { ColorBox } from '../views/nodes/ColorBox';
import { ComparisonBox } from '../views/nodes/ComparisonBox';
import { DataVizBox } from '../views/nodes/DataVizBox/DataVizBox';
@@ -269,7 +269,7 @@ export class DocumentOptions {
_label_maxFontSize?: NUMt = new NumInfo('maximum font size for labelBoxes', false);
stroke_width?: NUMt = new NumInfo('width of an ink stroke', false);
icon_label?: STRt = new StrInfo('label to use for a fontIcon doc (otherwise, the title is used)', false);
- mediaState?: STRt = new StrInfo('status of audio/video media document: "pendingRecording", "recording", "paused", "playing"', false);
+ mediaState?: STRt = new StrInfo(`status of audio/video media document: ${media_state.PendingRecording}, ${media_state.Recording}, ${media_state.Paused}, ${media_state.Playing}`, false);
recording?: BOOLt = new BoolInfo('whether WebCam is recording or not');
autoPlayAnchors?: BOOLt = new BoolInfo('whether to play audio/video when an anchor is clicked in a stackedTimeline.');
dontPlayLinkOnSelect?: BOOLt = new BoolInfo('whether an audio/video should start playing when a link is followed to it.');
diff --git a/src/client/views/SidebarAnnos.tsx b/src/client/views/SidebarAnnos.tsx
index f3452c780..ff347d65f 100644
--- a/src/client/views/SidebarAnnos.tsx
+++ b/src/client/views/SidebarAnnos.tsx
@@ -79,7 +79,6 @@ export class SidebarAnnos extends React.Component {
_layout_autoHeight: true,
_text_fontSize: StrCast(Doc.UserDoc().fontSize),
_text_fontFamily: StrCast(Doc.UserDoc().fontFamily),
- target: 'HELLO' as any,
});
FormattedTextBox.SelectOnLoad = target[Id];
FormattedTextBox.DontSelectInitialText = true;
diff --git a/src/client/views/collections/CollectionMenu.tsx b/src/client/views/collections/CollectionMenu.tsx
index 5c9dd2058..78ab0797b 100644
--- a/src/client/views/collections/CollectionMenu.tsx
+++ b/src/client/views/collections/CollectionMenu.tsx
@@ -41,6 +41,7 @@ import { COLLECTION_BORDER_WIDTH } from './CollectionView';
import { TabDocView } from './TabDocView';
import { CollectionFreeFormView } from './collectionFreeForm';
import { CollectionLinearView } from './collectionLinear';
+import { media_state } from '../nodes/AudioBox';
interface CollectionMenuProps {
panelHeight: () => number;
@@ -579,7 +580,7 @@ export class CollectionViewBaseChrome extends React.Component {
- const doc = Docs.Create.ScreenshotDocument({ title: 'screen recording', _layout_fitWidth: true, _width: 400, _height: 200, mediaState: 'pendingRecording' });
+ const doc = Docs.Create.ScreenshotDocument({ title: 'screen recording', _layout_fitWidth: true, _width: 400, _height: 200, mediaState: media_state.PendingRecording });
CollectionDockingView.AddSplit(doc, OpenWhereMod.right);
};
diff --git a/src/client/views/collections/CollectionStackedTimeline.tsx b/src/client/views/collections/CollectionStackedTimeline.tsx
index 0a5a80936..ad3160a08 100644
--- a/src/client/views/collections/CollectionStackedTimeline.tsx
+++ b/src/client/views/collections/CollectionStackedTimeline.tsx
@@ -161,6 +161,10 @@ export class CollectionStackedTimeline extends CollectionSubView {
+ e.stopPropagation();
+ this.timeline &&
+ setupMoveUpEvents(
+ this,
+ e,
+ returnFalse,
+ returnFalse,
+ action(e => {
+ if (this.timeline?.IsTrimming !== TrimScope.None) {
+ this.timeline?.CancelTrimming();
+ } else {
+ this.beginEndtime = this.timeline?.trimEnd;
+ this.beginStarttime = this.timeline?.trimStart;
+ this.startTrim(TrimScope.All);
+ }
+ })
+ );
+ };
+
+ beginEndtime: number | undefined;
+ beginStarttime: number | undefined;
+
// for trim button, double click displays full clip, single displays curr trim bounds
onClipPointerDown = (e: React.PointerEvent) => {
e.stopPropagation();
+ this.beginEndtime = this.timeline?.trimEnd;
+ this.beginStarttime = this.timeline?.trimStart;
this.timeline &&
setupMoveUpEvents(
this,
@@ -529,7 +556,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent {
const [xp, yp] = this.props.ScreenToLocalTransform().transformPoint(de.x, de.y);
- de.complete.docDragData && this.timeline.internalDocDrop(e, de, de.complete.docDragData, xp);
+ de.complete.docDragData && this.timeline?.internalDocDrop(e, de, de.complete.docDragData, xp);
},
this.layoutDoc,
undefined
@@ -591,9 +618,22 @@ export class AudioBox extends ViewBoxAnnotatableComponent
{!this.miniPlayer && (
-
-
-
+ <>
+ trim audio>}>
+
+
+
+
+ {this.timeline?.IsTrimming == TrimScope.None && !NumCast(this.layoutDoc.clipStart) && NumCast(this.layoutDoc.clipEnd) === this.rawDuration ? (
+ <>>
+ ) : (
+ {this.timeline?.IsTrimming !== TrimScope.None ? 'Cancel trimming' : 'Edit original timeline'}>}>
+
+
+
+
+ )}
+ >
)}
@@ -658,7 +698,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent
(this._stackedTimeline = r))}
+ ref={action((r: CollectionStackedTimeline | null) => (this._stackedTimeline = r))}
{...this.props}
CollectionFreeFormDocumentView={undefined}
dataFieldKey={this.fieldKey}
diff --git a/src/client/views/nodes/ScreenshotBox.tsx b/src/client/views/nodes/ScreenshotBox.tsx
index 26ad8b7bb..ebb8a3374 100644
--- a/src/client/views/nodes/ScreenshotBox.tsx
+++ b/src/client/views/nodes/ScreenshotBox.tsx
@@ -27,6 +27,7 @@ import { FormattedTextBox } from './formattedText/FormattedTextBox';
import './ScreenshotBox.scss';
import { VideoBox } from './VideoBox';
import { TrackMovements } from '../../util/TrackMovements';
+import { media_state } from './AudioBox';
declare class MediaRecorder {
constructor(e: any, options?: any); // whatever MediaRecorder has
@@ -181,7 +182,7 @@ export class ScreenshotBox extends ViewBoxAnnotatableComponent {
this._videoRef = r;
setTimeout(() => {
- if (this.rootDoc.mediaState === 'pendingRecording' && this._videoRef) {
+ if (this.rootDoc.mediaState === media_state.PendingRecording && this._videoRef) {
this.toggleRecording();
}
}, 100);
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 58b824159..6fdde4b6b 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -71,6 +71,7 @@ import { schema } from './schema_rts';
import { SummaryView } from './SummaryView';
import applyDevTools = require('prosemirror-dev-tools');
import React = require('react');
+import { media_state } from '../AudioBox';
const translateGoogleApi = require('translate-google-api');
export const GoogleRef = 'googleDocId';
type PullHandler = (exportState: Opt, dataDoc: Doc) => void;
@@ -154,10 +155,10 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent (stopFunc = stop));
let reactionDisposer = reaction(
@@ -389,7 +390,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
const anchor = (l.link_anchor_1 as Doc).annotationOn ? (l.link_anchor_1 as Doc) : (l.link_anchor_2 as Doc).annotationOn ? (l.link_anchor_2 as Doc) : undefined;
- if (anchor && (anchor.annotationOn as Doc).mediaState === 'recording') {
+ if (anchor && (anchor.annotationOn as Doc).mediaState === media_state.Recording) {
linkTime = NumCast(anchor._timecodeToShow /* audioStart */);
linkAnchor = anchor;
link = l;
--
cgit v1.2.3-70-g09d2
From 6499ac4b30c8f6ada2b0c7d74cd5f2a73f9bf180 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Sun, 10 Sep 2023 15:58:09 -0400
Subject: fixes for file uploads: restored progress for youtube videos, fixed
info display on loadingBoxes, stop client from asking for progress on failed
uploads. attempt to catch stream errors on webpages. fixed dataFieldView in
text to print out layout document's field, not field of document that
contains the field definition.
---
src/client/Network.ts | 4 ++--
src/client/documents/Documents.ts | 2 +-
src/client/views/nodes/LoadingBox.scss | 3 +++
src/client/views/nodes/LoadingBox.tsx | 4 ++--
.../views/nodes/formattedText/RichTextRules.ts | 9 +++-----
src/server/ApiManagers/UploadManager.ts | 7 +++----
src/server/DashUploadUtils.ts | 24 +++++++++++++---------
src/server/server_Initialization.ts | 13 +++++++++---
8 files changed, 38 insertions(+), 28 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/Network.ts b/src/client/Network.ts
index 39bf69e32..631ec9122 100644
--- a/src/client/Network.ts
+++ b/src/client/Network.ts
@@ -74,10 +74,10 @@ export namespace Networking {
return response.json();
}
- export async function UploadYoutubeToServer(videoId: string): Promise[]> {
+ export async function UploadYoutubeToServer(videoId: string, overwriteId?: string): Promise[]> {
const parameters = {
method: 'POST',
- body: JSON.stringify({ videoId }),
+ body: JSON.stringify({ videoId, overwriteId }),
json: true,
};
const response = await fetch('/uploadYoutubeVideo', parameters);
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 90c090f29..bb60cb329 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -1871,7 +1871,7 @@ export namespace DocUtils {
export function uploadYoutubeVideoLoading(videoId: string, options: DocumentOptions, overwriteDoc?: Doc) {
const generatedDocuments: Doc[] = [];
- Networking.UploadYoutubeToServer(videoId).then(upfiles => {
+ Networking.UploadYoutubeToServer(videoId, overwriteDoc?.[Id]).then(upfiles => {
const {
source: { name, type },
result,
diff --git a/src/client/views/nodes/LoadingBox.scss b/src/client/views/nodes/LoadingBox.scss
index d4a7e18f2..61a505420 100644
--- a/src/client/views/nodes/LoadingBox.scss
+++ b/src/client/views/nodes/LoadingBox.scss
@@ -21,6 +21,7 @@
.textContainer {
margin: 5px;
+ display: block;
}
.textContainer {
@@ -31,6 +32,8 @@
.headerText {
text-align: center;
font-weight: bold;
+ height: auto;
+ width: 100%;
}
.spinner {
diff --git a/src/client/views/nodes/LoadingBox.tsx b/src/client/views/nodes/LoadingBox.tsx
index 0b02626e9..58c70bdd7 100644
--- a/src/client/views/nodes/LoadingBox.tsx
+++ b/src/client/views/nodes/LoadingBox.tsx
@@ -46,7 +46,7 @@ export class LoadingBox extends ViewBoxAnnotatableComponent() {
const updateFunc = async () => {
const result = await Networking.QueryYoutubeProgress(StrCast(this.rootDoc[Id])); // We use the guid of the overwriteDoc to track file uploads.
runInAction(() => (this.progress = result.progress));
- this._timer = setTimeout(updateFunc, 1000);
+ !this.rootDoc.loadingError && (this._timer = setTimeout(updateFunc, 1000));
};
this._timer = setTimeout(updateFunc, 1000);
}
@@ -59,8 +59,8 @@ export class LoadingBox extends ViewBoxAnnotatableComponent() {
return (
-
{StrCast(this.rootDoc.loadingError, 'Loading ' + (this.progress.replace('[download]', '') || '(can take several minutes)'))}
{StrCast(this.rootDoc.title)}
+
{StrCast(this.rootDoc.loadingError, 'Loading ' + (this.progress.replace('[download]', '') || '(can take several minutes)'))}
{this.rootDoc.loadingError ? null :
}
diff --git a/src/client/views/nodes/formattedText/RichTextRules.ts b/src/client/views/nodes/formattedText/RichTextRules.ts
index 5d92f63ef..3e2afd2ce 100644
--- a/src/client/views/nodes/formattedText/RichTextRules.ts
+++ b/src/client/views/nodes/formattedText/RichTextRules.ts
@@ -279,12 +279,9 @@ export class RichTextRules {
const num = value.match(/^[0-9.]$/);
this.Document[DocData][fieldKey] = value === 'true' ? true : value === 'false' ? false : num ? Number(value) : value;
}
- const target = DocServer.FindDocByTitle(docTitle) ?? this.Document;
- if (target) {
- const fieldView = state.schema.nodes.dashField.create({ fieldKey, docId: target[Id], hideKey: false });
- return state.tr.setSelection(new TextSelection(state.doc.resolve(start), state.doc.resolve(end))).replaceSelectionWith(fieldView, true);
- }
- return state.tr;
+ const target = DocServer.FindDocByTitle(docTitle);
+ const fieldView = state.schema.nodes.dashField.create({ fieldKey, docId: target?.[Id], hideKey: false });
+ return state.tr.setSelection(new TextSelection(state.doc.resolve(start), state.doc.resolve(end))).replaceSelectionWith(fieldView, true);
}),
// create a text display of a metadata field on this or another document, or create a hyperlink portal to another document
diff --git a/src/server/ApiManagers/UploadManager.ts b/src/server/ApiManagers/UploadManager.ts
index ebc9deab7..c264803bd 100644
--- a/src/server/ApiManagers/UploadManager.ts
+++ b/src/server/ApiManagers/UploadManager.ts
@@ -102,11 +102,10 @@ export default class UploadManager extends ApiManager {
//req.readableBuffer.head.data
return new Promise(async resolve => {
req.addListener('data', async args => {
- console.log(args);
const payload = String.fromCharCode.apply(String, args);
- const videoId = JSON.parse(payload).videoId;
+ const { videoId, overwriteId } = JSON.parse(payload);
const results: Upload.FileResponse[] = [];
- const result = await DashUploadUtils.uploadYoutube(videoId);
+ const result = await DashUploadUtils.uploadYoutube(videoId, overwriteId ?? videoId);
result && results.push(result);
_success(res, results);
resolve();
@@ -123,7 +122,7 @@ export default class UploadManager extends ApiManager {
req.addListener('data', args => {
const payload = String.fromCharCode.apply(String, args);
const videoId = JSON.parse(payload).videoId;
- _success(res, { progress: DashUploadUtils.QueryYoutubeProgress(videoId) });
+ _success(res, { progress: DashUploadUtils.QueryYoutubeProgress(videoId, req.user) });
resolve();
});
});
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts
index ed2430e3a..1f23ae8c1 100644
--- a/src/server/DashUploadUtils.ts
+++ b/src/server/DashUploadUtils.ts
@@ -135,36 +135,39 @@ export namespace DashUploadUtils {
};
}
- export function QueryYoutubeProgress(videoId: string) {
- console.log("PROGRESS:" + videoId)
+ export function QueryYoutubeProgress(videoId: string, user?: Express.User) {
+ console.log(`PROGRESS:${videoId}`, (user as any)?.email);
return uploadProgress.get(videoId) ?? 'pending data upload';
}
let uploadProgress = new Map();
- export function uploadYoutube(videoId: string): Promise {
+ export function uploadYoutube(videoId: string, overwriteId: string): Promise {
return new Promise>((res, rej) => {
const name = videoId;
const path = name.replace(/^-/, '__') + '.mp4';
const finalPath = serverPathToFile(Directory.videos, path);
if (existsSync(finalPath)) {
- uploadProgress.set(videoId, 'computing duration');
+ uploadProgress.set(overwriteId, 'computing duration');
exec(`yt-dlp -o ${finalPath} "https://www.youtube.com/watch?v=${videoId}" --get-duration`, (error: any, stdout: any, stderr: any) => {
const time = Array.from(stdout.trim().split(':')).reverse();
const duration = (time.length > 2 ? Number(time[2]) * 1000 * 60 : 0) + (time.length > 1 ? Number(time[1]) * 60 : 0) + (time.length > 0 ? Number(time[0]) : 0);
res(resolveExistingFile(name, finalPath, Directory.videos, 'video/mp4', duration, undefined));
});
} else {
- uploadProgress.set(videoId, 'starting download');
+ uploadProgress.set(overwriteId, 'starting download');
const ytdlp = spawn(`yt-dlp`, ['-o', path, `https://www.youtube.com/watch?v=${videoId}`, '--max-filesize', '100M', '-f', 'mp4']);
- ytdlp.stdout.on('data', (data: any) => !uploadProgress.get(videoId)?.includes('Aborting.') && uploadProgress.set(videoId, data.toString()));
+ ytdlp.stdout.on('data', (data: any) => uploadProgress.set(overwriteId, data.toString()));
let errors = '';
- ytdlp.stderr.on('data', (data: any) => (errors = data.toString()));
+ ytdlp.stderr.on('data', (data: any) => {
+ uploadProgress.set(overwriteId, 'error:' + data.toString());
+ errors = data.toString();
+ });
ytdlp.on('exit', function (code: any) {
- if (code || uploadProgress.get(videoId)?.includes('Aborting.')) {
+ if (code) {
res({
source: {
size: 0,
@@ -176,7 +179,7 @@ export namespace DashUploadUtils {
result: { name: 'failed youtube query', message: `Could not archive video. ${code ? errors : uploadProgress.get(videoId)}` },
});
} else {
- uploadProgress.set(videoId, 'computing duration');
+ uploadProgress.set(overwriteId, 'computing duration');
exec(`yt-dlp-o ${path} "https://www.youtube.com/watch?v=${videoId}" --get-duration`, (error: any, stdout: any, stderr: any) => {
const time = Array.from(stdout.trim().split(':')).reverse();
const duration = (time.length > 2 ? Number(time[2]) * 1000 * 60 : 0) + (time.length > 1 ? Number(time[1]) * 60 : 0) + (time.length > 0 ? Number(time[0]) : 0);
@@ -194,7 +197,7 @@ export namespace DashUploadUtils {
const isAzureOn = usingAzure();
const { type, path, name } = file;
const types = type?.split('/') ?? [];
- console.log("UPLOADING:"+ (overwriteGuid ?? name));
+ console.log('UPLOADING:' + (overwriteGuid ?? name));
uploadProgress.set(overwriteGuid ?? name, 'uploading'); // If the client sent a guid it uses to track upload progress, use that guid. Otherwise, use the file's name.
const category = types[0];
@@ -282,6 +285,7 @@ export namespace DashUploadUtils {
const fileKey = (await md5File(file.path)) + '.pdf';
const textFilename = `${fileKey.substring(0, fileKey.length - 4)}.txt`;
if (fExists(fileKey, Directory.pdfs) && fExists(textFilename, Directory.text)) {
+ fs.unlink(file.path, () => {});
return new Promise(res => {
const textFilename = `${fileKey.substring(0, fileKey.length - 4)}.txt`;
const readStream = createReadStream(serverPathToFile(Directory.text, textFilename));
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts
index 64f90d76c..839091194 100644
--- a/src/server/server_Initialization.ts
+++ b/src/server/server_Initialization.ts
@@ -194,14 +194,20 @@ function proxyServe(req: any, requrl: string, response: any) {
.replace(/target="_blank"/g, '');
response.send(header?.includes('gzip') ? zlib.gzipSync(htmlText) : htmlText);
} else {
- req.pipe(request(requrl)).pipe(response);
+ req.pipe(request(requrl))
+ .on('error', (e: any) => console.log('requrl ', e))
+ .pipe(response)
+ .on('error', (e: any) => console.log('response pipe error', e));
console.log('EMPTY body:' + req.url);
}
} catch (e) {
console.log('ERROR?: ', e);
}
} else {
- req.pipe(htmlBodyMemoryStream).pipe(response);
+ req.pipe(htmlBodyMemoryStream)
+ .on('error', (e: any) => console.log('html body memorystream error', e))
+ .pipe(response)
+ .on('error', (e: any) => console.log('html body memory stream response error', e));
}
};
const retrieveHTTPBody = () => {
@@ -237,7 +243,8 @@ function proxyServe(req: any, requrl: string, response: any) {
response.headers = response._headers = res.headers;
})
.on('end', sendModifiedBody)
- .pipe(htmlBodyMemoryStream);
+ .pipe(htmlBodyMemoryStream)
+ .on('error', (e: any) => console.log('http body pipe error', e));
};
retrieveHTTPBody();
}
--
cgit v1.2.3-70-g09d2
From 507cdb40d5553c8a325ddb158b9a1f4e5672ac15 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Mon, 11 Sep 2023 22:35:42 -0400
Subject: moved edit on click script to developer. fixed highlight options for
My text. enabled chromeHidden for all doc types and applied it to RTF text
boxes. updated sliders in properties view to undo properly and to autorange,
and cleaned up ode.
---
package-lock.json | 30 ++--
package.json | 2 +-
src/client/views/PropertiesButtons.tsx | 2 +-
src/client/views/PropertiesSection.tsx | 6 +-
src/client/views/PropertiesView.scss | 3 +-
src/client/views/PropertiesView.tsx | 186 ++++++++++-----------
src/client/views/nodes/DocumentView.tsx | 4 +-
.../views/nodes/formattedText/FormattedTextBox.tsx | 10 +-
src/client/views/nodes/formattedText/marks_rts.ts | 2 +-
src/fields/DocSymbols.ts | 2 +-
10 files changed, 115 insertions(+), 132 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/package-lock.json b/package-lock.json
index 6055e9d1e..d15959b7d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2852,9 +2852,9 @@
}
},
"@floating-ui/dom": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.1.tgz",
- "integrity": "sha512-KwvVcPSXg6mQygvA1TjbN/gh///36kKtllIF8SUm0qpFj8+rvYrpvlYdL1JoA71SHpDqgSSdGOSoQ0Mp3uY5aw==",
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.2.tgz",
+ "integrity": "sha512-6ArmenS6qJEWmwzczWyhvrXRdI/rI78poBcW0h/456+onlabit+2G+QxHx5xTOX60NBJQXjsCLFbW2CmsXpUog==",
"requires": {
"@floating-ui/core": "^1.4.1",
"@floating-ui/utils": "^0.1.1"
@@ -2869,9 +2869,9 @@
}
},
"@floating-ui/utils": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz",
- "integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw=="
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.2.tgz",
+ "integrity": "sha512-ou3elfqG/hZsbmF4bxeJhPHIf3G2pm0ujc39hYEZrfVqt7Vk/Zji6CXc3W0pmYM8BW1g40U+akTl9DKZhFhInQ=="
},
"@fortawesome/fontawesome-common-types": {
"version": "6.4.0",
@@ -6687,9 +6687,9 @@
}
},
"browndash-components": {
- "version": "0.1.25",
- "resolved": "https://registry.npmjs.org/browndash-components/-/browndash-components-0.1.25.tgz",
- "integrity": "sha512-YgzUsfeUKwtaOLRYNDcxybZG2Ip7KSQV38VbUrgC+ycwOX/tzq9IWlfw2z4h/EVuVcq+ERCaBS4pb3mMU6pKGQ==",
+ "version": "0.1.35",
+ "resolved": "https://registry.npmjs.org/browndash-components/-/browndash-components-0.1.35.tgz",
+ "integrity": "sha512-xA4ACEppnDe5ThnUZPn9vo4W/KeZJZT5EFWh2tM0IsH/ZfcOhJopGfV6ZoIHHpvS5f/zi6l7YJuWaxd+aK5arg==",
"requires": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
@@ -10146,14 +10146,14 @@
}
},
"caniuse-lite": {
- "version": "1.0.30001529",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001529.tgz",
- "integrity": "sha512-n2pUQYGAkrLG4QYj2desAh+NqsJpHbNmVZz87imptDdxLAtjxary7Df/psdfyDGmskJK/9Dt9cPnx5RZ3CU4Og=="
+ "version": "1.0.30001532",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001532.tgz",
+ "integrity": "sha512-FbDFnNat3nMnrROzqrsg314zhqN5LGQ1kyyMk2opcrwGbVGpHRhgCWtAgD5YJUqNAiQ+dklreil/c3Qf1dfCTw=="
},
"electron-to-chromium": {
- "version": "1.4.513",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.513.tgz",
- "integrity": "sha512-cOB0xcInjm+E5qIssHeXJ29BaUyWpMyFKT5RB3bsLENDheCja0wMkHJyiPl0NBE/VzDI7JDuNEQWhe6RitEUcw=="
+ "version": "1.4.515",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.515.tgz",
+ "integrity": "sha512-VTq6vjk3kCfG2qdzQRd/i9dIyVVm0dbtZIgFzrLgfB73mXDQT2HPKVRc1EoZcAVUv9XhXAu08DWqJuababdGGg=="
}
}
},
diff --git a/package.json b/package.json
index 9f0b91628..92ebf0b0f 100644
--- a/package.json
+++ b/package.json
@@ -178,7 +178,7 @@
"body-parser": "^1.19.2",
"bootstrap": "^4.6.1",
"brotli": "^1.3.3",
- "browndash-components": "^0.1.25",
+ "browndash-components": "^0.1.35",
"browser-assert": "^1.2.1",
"bson": "^4.6.1",
"canvas": "^2.9.3",
diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index d939470e9..8b2b77aca 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -512,7 +512,7 @@ export class PropertiesButtons extends React.Component<{}, {}> {
{toggle(this.layout_autoHeightButton, { display: !isText && !isStacking && !isTree ? 'none' : '' })}
{toggle(this.maskButton, { display: !isInk ? 'none' : '' })}
{toggle(this.hideImageButton, { display: !isImage ? 'none' : '' })}
- {toggle(this.chromeButton, { display: !isCollection || isNovice ? 'none' : '' })}
+ {toggle(this.chromeButton, { display: isNovice ? 'none' : '' })}
{toggle(this.gridButton, { display: !isCollection ? 'none' : '' })}
{/* {toggle(this.groupButton, { display: isTabView || !isCollection ? 'none' : '' })} */}
{toggle(this.snapButton, { display: !isCollection ? 'none' : '' })}
diff --git a/src/client/views/PropertiesSection.tsx b/src/client/views/PropertiesSection.tsx
index b72e048df..0e7cd7e92 100644
--- a/src/client/views/PropertiesSection.tsx
+++ b/src/client/views/PropertiesSection.tsx
@@ -8,7 +8,7 @@ import { StrCast } from '../../fields/Types';
export interface PropertiesSectionProps {
title: string;
- content?: JSX.Element | string | null;
+ children?: JSX.Element | string | null;
isOpen: boolean;
setIsOpen: (bool: boolean) => any;
inSection?: boolean;
@@ -33,7 +33,7 @@ export class PropertiesSection extends React.Component {
@observable isDouble: boolean = false;
render() {
- if (this.props.content === undefined || this.props.content === null) return null;
+ if (this.props.children === undefined || this.props.children === null) return null;
else
return (
this.props.setInSection && this.props.setInSection(true))} onPointerLeave={action(() => this.props.setInSection && this.props.setInSection(false))}>
@@ -58,7 +58,7 @@ export class PropertiesSection extends React.Component
{
- {!this.props.isOpen ? null : {this.props.content}
}
+ {!this.props.isOpen ? null : {this.props.children}
}
);
}
diff --git a/src/client/views/PropertiesView.scss b/src/client/views/PropertiesView.scss
index 510defce4..2da2ec568 100644
--- a/src/client/views/PropertiesView.scss
+++ b/src/client/views/PropertiesView.scss
@@ -46,8 +46,7 @@
}
.propertiesView-info {
- margin-top: 20;
- margin-right: 10;
+ margin-top: -5;
float: right;
font-size: 20;
path {
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 9cc75b1c6..b25ac7903 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Checkbox, Tooltip } from '@material-ui/core';
import { Colors, EditableText, IconButton, NumberInput, Size, Slider, Type } from 'browndash-components';
import { concat } from 'lodash';
-import { action, computed, IReactionDisposer, observable, reaction } from 'mobx';
+import { action, computed, IReactionDisposer, observable, reaction, trace } from 'mobx';
import { observer } from 'mobx-react';
import { ColorState, SketchPicker } from 'react-color';
import * as Icons from 'react-icons/bs'; //{BsCollectionFill, BsFillFileEarmarkImageFill} from "react-icons/bs"
@@ -783,39 +783,39 @@ export class PropertiesView extends React.Component {
}
@computed get shapeXps() {
- return this.getField('x');
+ return NumCast(this.selectedDoc?.x);
}
@computed get shapeYps() {
- return this.getField('y');
+ return NumCast(this.selectedDoc?.y);
}
@computed get shapeHgt() {
- return this.getField('_height');
+ return NumCast(this.selectedDoc?._height);
}
@computed get shapeWid() {
- return this.getField('_width');
+ return NumCast(this.selectedDoc?._width);
}
set shapeXps(value) {
- this.selectedDoc && (this.selectedDoc.x = Number(value));
+ this.selectedDoc && (this.selectedDoc.x = Math.round(value * 100) / 100);
}
set shapeYps(value) {
- this.selectedDoc && (this.selectedDoc.y = Number(value));
+ this.selectedDoc && (this.selectedDoc.y = Math.round(value * 100) / 100);
}
set shapeWid(value) {
- this.selectedDoc && (this.selectedDoc._width = Number(value));
+ this.selectedDoc && (this.selectedDoc._width = Math.round(value * 100) / 100);
}
set shapeHgt(value) {
- this.selectedDoc && (this.selectedDoc._height = Number(value));
+ this.selectedDoc && (this.selectedDoc._height = Math.round(value * 100) / 100);
}
@computed get hgtInput() {
return this.inputBoxDuo(
'hgt',
this.shapeHgt,
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeHgt = val), 'set height'),
+ undoable((val: string) => !isNaN(Number(val)) && (this.shapeHgt = +val), 'set height'),
'H:',
'wid',
this.shapeWid,
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeWid = val), 'set width'),
+ undoable((val: string) => !isNaN(Number(val)) && (this.shapeWid = +val), 'set width'),
'W:'
);
}
@@ -823,11 +823,11 @@ export class PropertiesView extends React.Component {
return this.inputBoxDuo(
'Xps',
this.shapeXps,
- undoable((val: string) => val !== '0' && !isNaN(Number(val)) && (this.shapeXps = val), 'set x coord'),
+ undoable((val: string) => val !== '0' && !isNaN(Number(val)) && (this.shapeXps = +val), 'set x coord'),
'X:',
'Yps',
this.shapeYps,
- undoable((val: string) => val !== '0' && !isNaN(Number(val)) && (this.shapeYps = val), 'set y coord'),
+ undoable((val: string) => val !== '0' && !isNaN(Number(val)) && (this.shapeYps = +val), 'set y coord'),
'Y:'
);
}
@@ -1067,11 +1067,31 @@ export class PropertiesView extends React.Component {
);
}
- getNumber = (label: string, unit: string, min: number, max: number, number: number, setNumber: any) => {
+ _sliderBatch: UndoManager.Batch | undefined;
+ setFinalNumber = () => {
+ this._sliderBatch?.end();
+ };
+ getNumber = (label: string, unit: string, min: number, max: number, number: number, setNumber: any, autorange?: number, autorangeMinVal?: number) => {
return (
-
+
-
+ (this._sliderBatch = UndoManager.StartBatch('slider ' + label))}
+ multithumb={false}
+ color={this.color}
+ size={Size.XSMALL}
+ min={min}
+ max={max}
+ autorangeMinVal={autorangeMinVal}
+ autorange={autorange}
+ number={number}
+ unit={unit}
+ decimals={1}
+ setFinalNumber={this.setFinalNumber}
+ setNumber={setNumber}
+ fillWidth
+ />
);
};
@@ -1080,80 +1100,40 @@ export class PropertiesView extends React.Component
{
return (
{this.isInk ? this.controlPointsButton : null}
- {this.getNumber(
- 'Height',
- ' px',
- 0,
- 1000,
- Number(this.shapeHgt),
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeHgt = val), 'set height')
- )}
- {this.getNumber(
- 'Width',
- ' px',
- 0,
- 1000,
- Number(this.shapeWid),
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeWid = val), 'set width')
- )}
- {this.getNumber(
- 'X', //'X Coordinate',
- ' px',
- -2000,
- 2000,
- Number(this.shapeXps),
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeXps = val), 'set x coord')
- )}
- {this.getNumber(
- 'Y', //'Y Coordinate',
- ' px',
- -2000,
- 2000,
- Number(this.shapeYps),
- undoable((val: string) => !isNaN(Number(val)) && (this.shapeYps = val), 'set y coord')
- )}
+ {this.getNumber('Width', ' px', 0, Math.max(1000, this.shapeWid), this.shapeWid, (val: number) => !isNaN(val) && (this.shapeWid = val), 1000, 1)}
+ {this.getNumber('Height', ' px', 0, Math.max(1000, this.shapeHgt), this.shapeHgt, (val: number) => !isNaN(val) && (this.shapeHgt = val), 1000, 1)}
+ {this.getNumber('X', ' px', this.shapeXps - 500, this.shapeXps + 500, this.shapeXps, (val: number) => !isNaN(val) && (this.shapeXps = val), 1000)}
+ {this.getNumber('Y', ' px', this.shapeYps - 500, this.shapeYps + 500, this.shapeYps, (val: number) => !isNaN(val) && (this.shapeYps = val), 1000)}
);
}
@computed get optionsSubMenu() {
return (
- }
- inSection={this.inOptions}
- isOpen={this.openOptions}
- setInSection={bool => (this.inOptions = bool)}
- setIsOpen={bool => (this.openOptions = bool)}
- onDoubleClick={this.CloseAll}
- />
+ (this.inOptions = bool)} setIsOpen={bool => (this.openOptions = bool)} onDoubleClick={this.CloseAll}>
+
+
);
}
@computed get sharingSubMenu() {
return (
-
- {/* */}
-
- Layout Permissions
- (this.layoutDocAcls = !this.layoutDocAcls))} checked={this.layoutDocAcls} />
-
- {/*
{"Re-distribute sharing settings"}
>}>
-
+ (this.openSharing = bool)} onDoubleClick={() => this.CloseAll()}>
+ <>
+ {/* */}
+
+ Layout Permissions
+ (this.layoutDocAcls = !this.layoutDocAcls))} checked={this.layoutDocAcls} />
+
+ {/*
{"Re-distribute sharing settings"}
>}>
+
*/}
- {/*
*/}
- {this.sharingTable}
- >
- }
- isOpen={this.openSharing}
- setIsOpen={bool => (this.openSharing = bool)}
- onDoubleClick={() => this.CloseAll()}
- />
+ {/* */}
+ {this.sharingTable}
+ >
+
);
}
@@ -1183,17 +1163,11 @@ export class PropertiesView extends React.Component {
@computed get filtersSubMenu() {
return (
-
-
-
- }
- isOpen={this.openFilters}
- setIsOpen={bool => (this.openFilters = bool)}
- onDoubleClick={() => this.CloseAll()}
- />
+ (this.openFilters = bool)} onDoubleClick={() => this.CloseAll()}>
+
+
+
+
);
}
@@ -1202,36 +1176,46 @@ export class PropertiesView extends React.Component {
return (
<>
- (this.openAppearance = bool)} onDoubleClick={() => this.CloseAll()} />
- (this.openTransform = bool)} onDoubleClick={() => this.CloseAll()} />
+ (this.openAppearance = bool)} onDoubleClick={() => this.CloseAll()}>
+ {this.isInk ? this.appearanceEditor : null}
+
+ (this.openTransform = bool)} onDoubleClick={() => this.CloseAll()}>
+ {this.transformEditor}
+
>
);
}
@computed get fieldsSubMenu() {
return (
- {Doc.noviceMode ? this.noviceFields : this.expandedField}}
- isOpen={this.openFields}
- setIsOpen={bool => (this.openFields = bool)}
- onDoubleClick={() => this.CloseAll()}
- />
+ (this.openFields = bool)} onDoubleClick={() => this.CloseAll()}>
+ {Doc.noviceMode ? this.noviceFields : this.expandedField}
+
);
}
@computed get contextsSubMenu() {
return (
- 0 ? this.contexts : 'There are no other contexts.'} isOpen={this.openContexts} setIsOpen={bool => (this.openContexts = bool)} onDoubleClick={() => this.CloseAll()} />
+ (this.openContexts = bool)} onDoubleClick={() => this.CloseAll()}>
+ {this.contextCount > 0 ? this.contexts : 'There are no other contexts.'}
+
);
}
@computed get linksSubMenu() {
- return 0 ? this.links : 'There are no current links.'} isOpen={this.openLinks} setIsOpen={bool => (this.openLinks = bool)} onDoubleClick={this.CloseAll} />;
+ return (
+ (this.openLinks = bool)} onDoubleClick={this.CloseAll}>
+ {this.linkCount > 0 ? this.links : 'There are no current links.'}
+
+ );
}
@computed get layoutSubMenu() {
- return (this.openLayout = bool)} onDoubleClick={this.CloseAll} />;
+ return (
+ (this.openLayout = bool)} onDoubleClick={this.CloseAll}>
+ {this.layoutPreview}
+
+ );
}
@computed get description() {
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index ae9977d7a..da93a1b13 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -764,10 +764,10 @@ export class DocumentViewInternal extends DocComponent this.toggleFollowLink(false, false), icon: 'link' });
- onClicks.push({ description: 'Edit onClick Script', event: () => UndoManager.RunInBatch(() => DocUtils.makeCustomViewClicked(this.props.Document, undefined, 'onClick'), 'edit onClick'), icon: 'terminal' });
+ !Doc.noviceMode && onClicks.push({ description: 'Edit onClick Script', event: () => UndoManager.RunInBatch(() => DocUtils.makeCustomViewClicked(this.props.Document, undefined, 'onClick'), 'edit onClick'), icon: 'terminal' });
!existingOnClick && cm.addItem({ description: 'OnClick...', noexpand: true, subitems: onClicks, icon: 'mouse-pointer' });
} else if (LinkManager.Links(this.Document).length) {
- onClicks.push({ description: 'Select on Click', event: () => this.noOnClick(), icon: 'link' });
+ onClicks.push({ description: 'Restore On Click default', event: () => this.noOnClick(), icon: 'link' });
onClicks.push({ description: 'Follow Link on Click', event: () => this.followLinkOnClick(), icon: 'link' });
!existingOnClick && cm.addItem({ description: 'OnClick...', subitems: onClicks, icon: 'mouse-pointer' });
}
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 6fdde4b6b..42cc14f9c 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -666,7 +666,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent (this.layoutDoc._layout_enableAltContentUI = !this.layoutDoc._layout_enableAltContentUI),
icon: !this.Document._layout_enableAltContentUI ? 'eye-slash' : 'eye',
});
- uicontrols.push({ description: 'Show Highlights...', noexpand: true, subitems: highlighting, icon: 'hand-point-right' });
+ !Doc.noviceMode && uicontrols.push({ description: 'Show Highlights...', noexpand: true, subitems: highlighting, icon: 'hand-point-right' });
!Doc.noviceMode &&
uicontrols.push({
description: 'Broadcast Message',
@@ -2117,7 +2117,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent
{this.noSidebar || this.props.dontSelectOnLoad || !this.SidebarShown || this.layout_sidebarWidthPercent === '0%' ? null : this.sidebarCollection}
- {this.noSidebar || this.Document._layout_noSidebar || this.props.dontSelectOnLoad || this.Document._createDocOnCR ? null : this.sidebarHandle}
+ {this.noSidebar || this.Document._layout_noSidebar || this.props.dontSelectOnLoad || this.Document._createDocOnCR || this.layoutDoc._chromeHidden ? null : this.sidebarHandle}
{this.audioHandle}
- {this.layoutDoc._layout_enableAltContentUI ? this.overlayAlternateIcon : null}
+ {this.layoutDoc._layout_enableAltContentUI && !this.layoutDoc._chromeHidden ? this.overlayAlternateIcon : null}
);
diff --git a/src/client/views/nodes/formattedText/marks_rts.ts b/src/client/views/nodes/formattedText/marks_rts.ts
index 7e17008bb..6f07588b3 100644
--- a/src/client/views/nodes/formattedText/marks_rts.ts
+++ b/src/client/views/nodes/formattedText/marks_rts.ts
@@ -348,7 +348,7 @@ export const marks: { [index: string]: MarkSpec } = {
excludes: 'user_mark',
group: 'inline',
toDOM(node: any) {
- const uid = node.attrs.userid.replace('.', '').replace('@', '');
+ const uid = node.attrs.userid.replace(/\./g, '').replace(/@/g, '');
const min = Math.round(node.attrs.modified / 60);
const hr = Math.round(min / 60);
const day = Math.round(hr / 60 / 24);
diff --git a/src/fields/DocSymbols.ts b/src/fields/DocSymbols.ts
index bb974ee74..df74cc9fe 100644
--- a/src/fields/DocSymbols.ts
+++ b/src/fields/DocSymbols.ts
@@ -25,4 +25,4 @@ export const Initializing = Symbol('DocInitializing');
export const ForceServerWrite = Symbol('DocForceServerWrite');
export const CachedUpdates = Symbol('DocCachedUpdates');
-export const DashVersion = 'v0.5.99';
+export const DashVersion = 'v0.6.00';
--
cgit v1.2.3-70-g09d2
From cfef242e9b76ba9caca2fc1871af74af6775538f Mon Sep 17 00:00:00 2001
From: bobzel
Date: Tue, 12 Sep 2023 20:43:20 -0400
Subject: dropping link button on same collection makes a pushpin. fixed broken
undo typing to crate doc in sidebar. fixed min/max scaling for cropped images
and made annotationOverlays start to use it. Fixed nested text boxes to
stopPropagation on pointer down to enable editing of translations in sidebar.
moved sidebar filters onto doc's filters. Added metadata filters back to
sidebar. Added an -any- option to filtersPanel. fixed schema view preview
window, added buttons and sliders.
---
package-lock.json | 119 ++++++++++++++++-----
package.json | 4 +-
src/client/documents/Documents.ts | 7 +-
src/client/util/CurrentUserUtils.ts | 10 +-
src/client/views/FilterPanel.tsx | 20 ++--
src/client/views/PropertiesView.tsx | 7 +-
src/client/views/SidebarAnnos.tsx | 30 +++---
src/client/views/StyleProvider.tsx | 2 +-
.../views/collections/CollectionStackingView.tsx | 2 +-
.../CollectionStackingViewFieldColumn.tsx | 6 +-
.../collectionFreeForm/CollectionFreeFormView.tsx | 44 +++++---
.../collectionSchema/CollectionSchemaView.scss | 8 +-
.../collectionSchema/CollectionSchemaView.tsx | 1 +
.../collections/collectionSchema/SchemaRowBox.tsx | 4 +-
.../collectionSchema/SchemaTableCell.tsx | 26 ++++-
src/client/views/global/globalScripts.ts | 8 +-
.../views/nodes/CollectionFreeFormDocumentView.tsx | 1 -
src/client/views/nodes/ImageBox.tsx | 10 +-
src/client/views/nodes/PDFBox.tsx | 4 +-
.../views/nodes/formattedText/FormattedTextBox.tsx | 51 ++++++---
src/fields/Doc.ts | 1 +
21 files changed, 255 insertions(+), 110 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/package-lock.json b/package-lock.json
index e0e54769a..fbfdf0136 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7244,12 +7244,97 @@
"strip-ansi": "^7.0.1"
}
},
+ "string-width-cjs": {
+ "version": "npm:string-width@4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ }
+ }
+ },
"strip-ansi": {
"version": "7.1.0",
"bundled": true,
"requires": {
"ansi-regex": "^6.0.1"
}
+ },
+ "strip-ansi-cjs": {
+ "version": "npm:strip-ansi@6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
+ }
+ }
+ },
+ "wrap-ansi-cjs": {
+ "version": "npm:wrap-ansi@7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
+ },
+ "string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "requires": {
+ "ansi-regex": "^5.0.1"
+ }
+ }
+ }
}
}
},
@@ -8754,7 +8839,7 @@
}
},
"string-width-cjs": {
- "version": "npm:string-width@4.2.3",
+ "version": "npm:string-width-cjs@4.2.3",
"bundled": true,
"requires": {
"emoji-regex": "^8.0.0",
@@ -8777,7 +8862,7 @@
}
},
"strip-ansi-cjs": {
- "version": "npm:strip-ansi@6.0.1",
+ "version": "npm:strip-ansi-cjs@6.0.1",
"bundled": true,
"requires": {
"ansi-regex": "^5.0.1"
@@ -8936,7 +9021,7 @@
}
},
"wrap-ansi-cjs": {
- "version": "npm:wrap-ansi@7.0.0",
+ "version": "npm:wrap-ansi-cjs@7.0.0",
"bundled": true,
"requires": {
"ansi-styles": "^4.0.0",
@@ -14742,6 +14827,11 @@
"node-forge": "^0.10.0"
}
},
+ "google-translate-api-browser": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/google-translate-api-browser/-/google-translate-api-browser-3.0.1.tgz",
+ "integrity": "sha512-KTLodkyGBWMK9IW6QIeJ2zCuju4Z0CLpbkADKo+yLhbSTD4l+CXXpQ/xaynGVAzeBezzJG6qn8MLeqOq3SmW0A=="
+ },
"googleapis": {
"version": "40.0.1",
"resolved": "https://registry.npmjs.org/googleapis/-/googleapis-40.0.1.tgz",
@@ -27327,29 +27417,6 @@
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
},
- "translate-google-api": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/translate-google-api/-/translate-google-api-1.0.4.tgz",
- "integrity": "sha512-KVXmo4+64/H1vIbnzf2zNiJ2JLeEB3jrEnNRP2EFNAGNqna/5bmw/Cps3pCHu0n3BzTOoWh9u6wFvrRYdzQ6Iw==",
- "requires": {
- "axios": "^0.20.0"
- },
- "dependencies": {
- "axios": {
- "version": "0.20.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
- "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
- "requires": {
- "follow-redirects": "^1.10.0"
- }
- },
- "follow-redirects": {
- "version": "1.15.2",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
- "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
- }
- }
- },
"traverse-chain": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz",
diff --git a/package.json b/package.json
index 67fdedeb2..d013ad74d 100644
--- a/package.json
+++ b/package.json
@@ -164,6 +164,7 @@
"@types/three": "^0.126.2",
"@types/web": "0.0.53",
"@webscopeio/react-textarea-autocomplete": "^4.9.1",
+ "D": "^1.0.0",
"adm-zip": "^0.4.16",
"archiver": "^3.1.1",
"array-batcher": "^1.2.3",
@@ -196,7 +197,6 @@
"cors": "^2.8.5",
"csv-parser": "^3.0.0",
"csv-stringify": "^6.3.0",
- "D": "^1.0.0",
"d3": "^7.6.1",
"depcheck": "^0.9.2",
"equation-editor-react": "github:bobzel/equation-editor-react#useLocally",
@@ -219,6 +219,7 @@
"golden-layout": "^1.5.9",
"google-auth-library": "^4.2.4",
"google-maps-react": "^2.0.6",
+ "google-translate-api-browser": "^3.0.1",
"googleapis": "^40.0.0",
"googlephotos": "^0.2.5",
"got": "^12.0.1",
@@ -327,7 +328,6 @@
"textarea-caret": "^3.1.0",
"three": "^0.127.0",
"tough-cookie": "^4.0.0",
- "translate-google-api": "^1.0.4",
"typescript-collections": "^1.3.3",
"typescript-language-server": "^0.4.0",
"url-loader": "^1.1.2",
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index bb60cb329..85ee4ef59 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -145,7 +145,6 @@ class CTypeInfo extends FInfo {
class DTypeInfo extends FInfo {
fieldType? = 'enumeration';
values? = Array.from(Object.keys(DocumentType));
- readOnly = true;
}
class DateInfo extends FInfo {
fieldType? = 'date';
@@ -338,11 +337,13 @@ export class DocumentOptions {
// freeform properties
_freeform_backgroundGrid?: BOOLt = new BoolInfo('whether background grid is shown on freeform collections');
+ _freeform_scale_min?: NUMt = new NumInfo('how far out a view can zoom (used by image/videoBoxes that are clipped');
+ _freeform_scale_max?: NUMt = new NumInfo('how far in a view can zoom (used by sidebar freeform views');
_freeform_scale?: NUMt = new NumInfo('how much a freeform view has been scaled (zoomed)');
_freeform_panX?: NUMt = new NumInfo('horizontal pan location of a freeform view');
_freeform_panY?: NUMt = new NumInfo('vertical pan location of a freeform view');
_freeform_noAutoPan?: BOOLt = new BoolInfo('disables autopanning when this item is dragged');
- _freeform_noZoom?: BOOLt = new BoolInfo('disables zooming');
+ _freeform_noZoom?: BOOLt = new BoolInfo('disables zooming (used by Pile docs)');
//BUTTONS
buttonText?: string;
@@ -426,7 +427,7 @@ export class DocumentOptions {
treeView_FreezeChildren?: STRt = new StrInfo('set (add, remove, add|remove) to disable adding, removing or both from collection');
sidebar_color?: string; // background color of text sidebar
- sidebar_collectionType?: string; // collection type of text sidebar
+ sidebar_type_collection?: string; // collection type of text sidebar
data_dashboards?: List; // list of dashboards used in shareddocs;
text?: string;
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 8bedea562..527f251f9 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -627,6 +627,11 @@ export class CurrentUserUtils {
{ title: "Z order", icon: "z", toolTip: "Keep Z order on Drag", btnType: ButtonType.ToggleButton, expertMode: false, funcs: {}, scripts: { onClick: '{ return toggleRaiseOnDrag(_readOnly_);}'}}, // Only when floating document is selected in freeform
]
}
+ static stackTools(): Button[] {
+ return [
+ { title: "Center", icon: "align-center", toolTip: "Center Align Stack", btnType: ButtonType.ToggleButton, ignoreClick: true, expertMode: false, toolType:"center", funcs: {}, scripts: { onClick: '{ return showFreeform(self.toolType, _readOnly_);}'}}, // Only when floating document is selected in freeform
+ ]
+ }
static viewTools(): Button[] {
return [
{ title: "Snap", icon: "th", toolTip: "Show Snap Lines", btnType: ButtonType.ToggleButton, ignoreClick: true, expertMode: false, toolType:"snaplines", funcs: {}, scripts: { onClick: '{ return showFreeform(self.toolType, _readOnly_);}'}}, // Only when floating document is selected in freeform
@@ -682,8 +687,8 @@ export class CurrentUserUtils {
static schemaTools():Button[] {
return [
- {title: "Show preview", toolTip: "Show selection preview", btnType: ButtonType.ToggleButton, buttonText: "Show Preview", icon: "eye", scripts:{ onClick: '{ return toggleSchemaPreview(_readOnly_); }'} },
- {title: "Single Lines", toolTip: "Single Line Rows", btnType: ButtonType.ToggleButton, buttonText: "Single Line", icon: "eye", scripts:{ onClick: '{ return toggleSingleLineSchema(_readOnly_); }'} },
+ {title: "Preview", toolTip: "Show selection preview", btnType: ButtonType.ToggleButton, icon: "portrait", scripts:{ onClick: '{ return toggleSchemaPreview(_readOnly_); }'} },
+ {title: "1 Line",toolTip: "Single Line Rows", btnType: ButtonType.ToggleButton, icon: "eye", scripts:{ onClick: '{ return toggleSingleLineSchema(_readOnly_); }'} },
];
}
@@ -713,6 +718,7 @@ export class CurrentUserUtils {
{ title: "Ink", icon: "Ink", toolTip: "Ink functions", subMenu: CurrentUserUtils.inkTools(), expertMode: false, toolType:DocumentType.INK, funcs: { linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`}, scripts: { onClick: 'setInkToolDefaults()'} }, // Always available
{ title: "Doc", icon: "Doc", toolTip: "Freeform Doc tools", subMenu: CurrentUserUtils.freeTools(), expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode, true)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
{ title: "View", icon: "View", toolTip: "View tools", subMenu: CurrentUserUtils.viewTools(), expertMode: false, toolType:CollectionViewType.Freeform, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
+ { title: "Stack", icon: "View", toolTip: "Stacking tools", subMenu: CurrentUserUtils.stackTools(), expertMode: false, toolType:CollectionViewType.Stacking, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Always available
{ title: "Web", icon: "Web", toolTip: "Web functions", subMenu: CurrentUserUtils.webTools(), expertMode: false, toolType:DocumentType.WEB, funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Web is selected
{ title: "Schema", icon: "Schema",linearBtnWidth:58,toolTip: "Schema functions",subMenu: CurrentUserUtils.schemaTools(),expertMode: false,toolType:CollectionViewType.Schema,funcs: {hidden: `!SelectionManager_selectedDocType(self.toolType, self.expertMode)`, linearView_IsOpen: `SelectionManager_selectedDocType(self.toolType, self.expertMode)`} }, // Only when Schema is selected
];
diff --git a/src/client/views/FilterPanel.tsx b/src/client/views/FilterPanel.tsx
index 0d4f4df5a..a601706ce 100644
--- a/src/client/views/FilterPanel.tsx
+++ b/src/client/views/FilterPanel.tsx
@@ -235,7 +235,7 @@ export class FilterPanel extends React.Component {
facetValues = (facetHeader: string) => {
const allCollectionDocs = new Set();
SearchUtil.foreachRecursiveDoc(this.targetDocChildren, (depth: number, doc: Doc) => allCollectionDocs.add(doc));
- const set = new Set([String.fromCharCode(127) + '--undefined--']);
+ const set = new Set([String.fromCharCode(127) + '--undefined--', Doc.FilterAny]);
if (facetHeader === 'tags')
allCollectionDocs.forEach(child =>
StrListCast(child[facetHeader])
@@ -257,24 +257,16 @@ export class FilterPanel extends React.Component {
};
render() {
- // console.log('this is frist one today ' + this._allFacets);
- this._allFacets.forEach(element => console.log(element));
- // const options = Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => pair[1].filterable ).map(facet => value: facet, label: facet) //this._allFacets.filter(facet => this.activeFacetHeaders.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet }));
- // console.log('HEELLLLLL ' + DocumentOptions);
-
- let filteredOptions: string[] = ['author', 'tags', 'text', 'acl-Guest'];
+ let filteredOptions: string[] = ['author', 'tags', 'text', 'acl-Guest', ...this._allFacets.filter(facet => facet[0] === facet.charAt(0).toUpperCase())];
Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => {
if (pair[1].filterable) {
filteredOptions.push(pair[0]);
- console.log('THIS IS FILTERABLE ALKDJFIIEII' + filteredOptions);
}
});
let options = filteredOptions.map(facet => ({ value: facet, label: facet }));
- // Object.entries(this._documentOptions).forEach((pair: [string, FInfo]) => console.log('this is first piar ' + pair[0] + ' this is second piar ' + pair[1].filterable));
-
return (
@@ -398,13 +390,13 @@ export class FilterPanel extends React.Component
{
filter.split(Doc.FilterSep)[0] === facetHeader && filter.split(Doc.FilterSep)[1] == facetValue)
- ?.split(Doc.FilterSep)[2] === 'check'
- }
+ ?.split(Doc.FilterSep)[2] ?? ''
+ )}
type={type}
- onChange={undoable(e => Doc.setDocFilter(this.targetDoc, facetHeader, fval, e.target.checked ? 'check' : 'remove'), 'set filter')}
+ onChange={undoable(e => Doc.setDocFilter(this.targetDoc, facetHeader, fval, e.target.checked ? (fval === Doc.FilterAny ? 'exists' : 'check') : 'remove'), 'set filter')}
/>
{facetValue}
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index 699aafe80..21b6bfac5 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -18,7 +18,7 @@ import { ComputedField } from '../../fields/ScriptField';
import { Cast, DocCast, NumCast, StrCast } from '../../fields/Types';
import { GetEffectiveAcl, normalizeEmail, SharingPermissions } from '../../fields/util';
import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, setupMoveUpEvents, Utils } from '../../Utils';
-import { DocumentType } from '../documents/DocumentTypes';
+import { CollectionViewType, DocumentType } from '../documents/DocumentTypes';
import { DocumentManager } from '../util/DocumentManager';
import { GroupManager } from '../util/GroupManager';
import { LinkManager } from '../util/LinkManager';
@@ -122,6 +122,9 @@ export class PropertiesView extends React.Component {
@computed get isInk() {
return this.selectedDoc?.type === DocumentType.INK;
}
+ @computed get isStack() {
+ return this.selectedDoc?.type_collection === CollectionViewType.Stacking;
+ }
rtfWidth = () => (!this.selectedDoc ? 0 : Math.min(this.selectedDoc?.[Width](), this.props.width - 20));
rtfHeight = () => (!this.selectedDoc ? 0 : this.rtfWidth() <= this.selectedDoc?.[Width]() ? Math.min(this.selectedDoc?.[Height](), this.MAX_EMBED_HEIGHT) : this.MAX_EMBED_HEIGHT);
@@ -1096,6 +1099,8 @@ export class PropertiesView extends React.Component {
@computed get transformEditor() {
return (
+ {!this.isStack ? null : this.getNumber('Gap', ' px', 0, 200, NumCast(this.selectedDoc!.gridGap), (val: number) => !isNaN(val) && (this.selectedDoc!.gridGap = val))}
+ {!this.isStack ? null : this.getNumber('xMargin', ' px', 0, 500, NumCast(this.selectedDoc!.xMargin), (val: number) => !isNaN(val) && (this.selectedDoc!.xMargin = val))}
{this.isInk ? this.controlPointsButton : null}
{this.getNumber('Width', ' px', 0, Math.max(1000, this.shapeWid), this.shapeWid, (val: number) => !isNaN(val) && (this.shapeWid = val), 1000, 1)}
{this.getNumber('Height', ' px', 0, Math.max(1000, this.shapeHgt), this.shapeHgt, (val: number) => !isNaN(val) && (this.shapeHgt = val), 1000, 1)}
diff --git a/src/client/views/SidebarAnnos.tsx b/src/client/views/SidebarAnnos.tsx
index ff347d65f..1e1b8e0e6 100644
--- a/src/client/views/SidebarAnnos.tsx
+++ b/src/client/views/SidebarAnnos.tsx
@@ -62,12 +62,9 @@ export class SidebarAnnos extends React.Component
{
DocListCast(this.props.rootDoc[this.sidebarKey]).forEach(doc => keys.add(StrCast(doc.author)));
return Array.from(keys.keys()).sort();
}
- get filtersKey() {
- return '_' + this.sidebarKey + '_childFilters';
- }
anchorMenuClick = (anchor: Doc, filterExlusions?: string[]) => {
- const startup = StrListCast(this.props.rootDoc.childFilters)
+ const startup = this.childFilters()
.map(filter => filter.split(':')[0])
.join(' ');
const target = Docs.Create.TextDocument(startup, {
@@ -151,8 +148,9 @@ export class SidebarAnnos extends React.Component {
};
makeDocUnfiltered = (doc: Doc) => {
if (DocListCast(this.props.rootDoc[this.sidebarKey]).find(anno => Doc.AreProtosEqual(doc.layout_unrendered ? DocCast(doc.annotationOn) : doc, anno))) {
- if (this.props.layoutDoc[this.filtersKey]) {
- this.props.layoutDoc[this.filtersKey] = new List();
+ if (this.childFilters()) {
+ // if any child filters exist, get rid of them
+ this.props.layoutDoc._childFilters = new List();
}
return true;
}
@@ -178,7 +176,7 @@ export class SidebarAnnos extends React.Component {
addDocument = (doc: Doc | Doc[]) => this.props.sidebarAddDocument(doc, this.sidebarKey);
moveDocument = (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[]) => boolean) => this.props.moveDocument(doc, targetCollection, addDocument, this.sidebarKey);
removeDocument = (doc: Doc | Doc[]) => this.props.removeDocument(doc, this.sidebarKey);
- childFilters = () => [...StrListCast(this.props.layoutDoc._childFilters), ...StrListCast(this.props.layoutDoc[this.filtersKey])];
+ childFilters = () => StrListCast(this.props.layoutDoc._childFilters);
layout_showTitle = () => 'title';
setHeightCallback = (height: number) => this.props.setHeight?.(height + this.filtersHeight());
sortByLinkAnchorY = (a: Doc, b: Doc) => {
@@ -188,25 +186,25 @@ export class SidebarAnnos extends React.Component {
};
render() {
const renderTag = (tag: string) => {
- const active = StrListCast(this.props.rootDoc[this.filtersKey]).includes(`tags::${tag}::check`);
+ const active = this.childFilters().includes(`tags${Doc.FilterSep}${tag}${Doc.FilterSep}check`);
return (
- Doc.setDocFilter(this.props.rootDoc, 'tags', tag, 'check', true, this.sidebarKey, e.shiftKey)}>
+
Doc.setDocFilter(this.props.rootDoc, 'tags', tag, 'check', true, undefined, e.shiftKey)}>
{tag}
);
};
const renderMeta = (tag: string, dflt: FieldResult
) => {
- const active = StrListCast(this.props.rootDoc[this.filtersKey]).includes(`${tag}:${dflt}:exists`);
+ const active = this.childFilters().includes(`${tag}${Doc.FilterSep}${Doc.FilterAny}${Doc.FilterSep}exists`);
return (
- Doc.setDocFilter(this.props.rootDoc, tag, dflt, 'exists', true, this.sidebarKey, e.shiftKey)}>
+
Doc.setDocFilter(this.props.rootDoc, tag, Doc.FilterAny, 'exists', true, undefined, e.shiftKey)}>
{tag}
);
};
const renderUsers = (user: string) => {
- const active = StrListCast(this.props.rootDoc[this.filtersKey]).includes(`author:${user}:check`);
+ const active = this.childFilters().includes(`author:${user}:check`);
return (
-
Doc.setDocFilter(this.props.rootDoc, 'author', user, 'check', true, this.sidebarKey, e.shiftKey)}>
+
Doc.setDocFilter(this.props.rootDoc, 'author', user, 'check', true, undefined, e.shiftKey)}>
{user}
);
@@ -224,11 +222,11 @@ export class SidebarAnnos extends React.Component
{
height: '100%',
}}>
e.stopPropagation()}>
- {this.allUsers.map(renderUsers)}
+ {this.allUsers.length > 1 ? this.allUsers.map(renderUsers) : null}
{this.allHashtags.map(renderTag)}
- {/* {Array.from(this.allMetadata.keys())
+ {Array.from(this.allMetadata.keys())
.sort()
- .map(key => renderMeta(key, this.allMetadata.get(key)))} */}
+ .map(key => renderMeta(key, this.allMetadata.get(key)))}
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index 85aa5ad83..0a14b93f7 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -317,7 +317,7 @@ export function DefaultStyleProvider(doc: Opt
, props: Opt ({
+ items={[ DocumentManager.Instance.getDocumentView(Doc.ActiveDashboard)!, ...(props?.docViewPath?.()??[]), ...(props?.DocumentView?[props?.DocumentView?.()]:[])].map(dv => ({
text: StrCast(dv.rootDoc.title),
val: dv as any,
style: {color:SettingsManager.userColor, background:SettingsManager.userBackgroundColor},
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 9ba4cb6cf..8c40567d3 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -138,7 +138,7 @@ export class CollectionStackingView extends CollectionSubView
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
index 3aadeffcd..3598d548a 100644
--- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
@@ -361,7 +361,11 @@ export class CollectionStackingViewFieldColumn extends React.Component
+ e.stopPropagation()}
+ className="collectionStackingView-addDocumentButton"
+ style={{ width: 'calc(100% - 25px)', maxWidth: this.props.columnWidth / this.props.numGroupColumns - 25, marginBottom: 10 }}>
number;
@@ -421,11 +422,27 @@ export class CollectionFreeFormView extends CollectionSubView {
- if (this.Document._isGroup || this.Document._freeform_noZoom) return;
+ if (this.Document._isGroup || this.Document[this.scaleFieldKey + '_noZoom']) return;
let deltaScale = deltaY > 0 ? 1 / 1.05 : 1.05;
if (deltaScale < 0) deltaScale = -deltaScale;
const [x, y] = this.getTransform().transformPoint(pointX, pointY);
@@ -1032,12 +1049,15 @@ export class CollectionFreeFormView extends CollectionSubView 20) {
deltaScale = 20 / invTransform.Scale;
}
- if (deltaScale < 1 && invTransform.Scale <= NumCast(this.rootDoc._freeform_scale_min, 1) && this.isAnnotationOverlay) {
+ if (deltaScale < 1 && invTransform.Scale <= NumCast(this.rootDoc[this.scaleFieldKey + '_min'])) {
this.setPan(0, 0);
return;
}
- if (deltaScale * invTransform.Scale < NumCast(this.rootDoc._freeform_scale_min, 1) && this.isAnnotationOverlay) {
- deltaScale = NumCast(this.rootDoc._freeform_scale_min, 1) / invTransform.Scale;
+ if (deltaScale * invTransform.Scale > NumCast(this.rootDoc[this.scaleFieldKey + '_max'], Number.MAX_VALUE)) {
+ deltaScale = NumCast(this.rootDoc[this.scaleFieldKey + '_max'], 1) / invTransform.Scale;
+ }
+ if (deltaScale * invTransform.Scale < NumCast(this.rootDoc[this.scaleFieldKey + '_min'], this.isAnnotationOverlay ? 1 : 0)) {
+ deltaScale = NumCast(this.rootDoc[this.scaleFieldKey + '_min'], 1) / invTransform.Scale;
}
const localTransform = invTransform.scaleAbout(deltaScale, x, y);
@@ -1527,12 +1547,6 @@ export class CollectionFreeFormView extends CollectionSubView .schema-column-header:nth-child(2) > .left {
@@ -205,7 +211,7 @@
overflow-x: hidden;
overflow-y: auto;
padding: 5px;
- display: inline-block;
+ display: inline-flex;
}
.schema-row {
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 5c7dcc1a4..d757d5349 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -836,6 +836,7 @@ export class CollectionSchemaView extends CollectionSubView() {
this.props.isContentActive() && e.stopPropagation()}
ref={r => {
// prevent wheel events from passively propagating up through containers
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index 5b4fc34bb..4e418728f 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -16,7 +16,7 @@ import { CollectionSchemaView } from './CollectionSchemaView';
import './CollectionSchemaView.scss';
import { SchemaTableCell } from './SchemaTableCell';
import { Transform } from '../../../util/Transform';
-import { IconButton } from 'browndash-components';
+import { IconButton, Size } from 'browndash-components';
import { CgClose } from 'react-icons/cg';
import { FaExternalLinkAlt } from 'react-icons/fa';
import { emptyFunction, returnFalse, setupMoveUpEvents } from '../../../../Utils';
@@ -117,6 +117,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent
() {
}
+ size={Size.XSMALL}
onPointerDown={e =>
setupMoveUpEvents(
this,
@@ -133,6 +134,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() {
}
+ size={Size.XSMALL}
onPointerDown={e =>
setupMoveUpEvents(
this,
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 1c9c0de53..e18f27fb0 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -325,10 +325,34 @@ export class SchemaEnumerationCell extends React.Component
const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this.props);
const options = this.props.options?.map(facet => ({ value: facet, label: facet }));
return (
-
+
);
}
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 42cc14f9c..7eab1ea4e 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -72,7 +72,9 @@ import { SummaryView } from './SummaryView';
import applyDevTools = require('prosemirror-dev-tools');
import React = require('react');
import { media_state } from '../AudioBox';
-const translateGoogleApi = require('translate-google-api');
+import { setCORS } from 'google-translate-api-browser';
+// setting up cors-anywhere server address
+const translate = setCORS('http://cors-anywhere.herokuapp.com/');
export const GoogleRef = 'googleDocId';
type PullHandler = (exportState: Opt
, dataDoc: Doc) => void;
@@ -94,6 +96,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent();
+ private _sidebarTagRef = React.createRef();
private _ref: React.RefObject = React.createRef();
private _scrollRef: React.RefObject = React.createRef();
private _editorView: Opt;
@@ -706,7 +709,10 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
const prevWidth = 1 - this.sidebarWidth() / Number(getComputedStyle(this._ref.current!).width.replace('px', ''));
if (preview) this._showSidebar = true;
- else this.layoutDoc._layout_showSidebar = (this.layoutDoc._layout_sidebarWidthPercent = StrCast(this.layoutDoc._layout_sidebarWidthPercent, '0%') === '0%' ? '50%' : '0%') !== '0%';
+ else {
+ this.layoutDoc[this.SidebarKey + '_freeform_scale_max'] = 1;
+ this.layoutDoc._layout_showSidebar = (this.layoutDoc._layout_sidebarWidthPercent = StrCast(this.layoutDoc._layout_sidebarWidthPercent, '0%') === '0%' ? '50%' : '0%') !== '0%';
+ }
this.layoutDoc._width = !preview && this.SidebarShown ? NumCast(this.layoutDoc._width) * 2 : Math.max(20, NumCast(this.layoutDoc._width) * prevWidth);
};
@@ -1580,7 +1586,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
if ((e.nativeEvent as any).handledByInnerReactInstance) {
- return e.stopPropagation();
+ return; //e.stopPropagation();
} else (e.nativeEvent as any).handledByInnerReactInstance = true;
if (this.Document.forceActive) e.stopPropagation();
@@ -1612,10 +1618,8 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
+ translate(curText, { from: 'en', to: 'es' }).then((result1: any) => {
setTimeout(
() =>
- translateGoogleApi(result1[0], { from: 'es', to: 'en' }).then((result: any) => {
- this.dataDoc[this.fieldKey + '_translation'] = result1 + '\r\n\r\n' + result[0];
+ translate(result1.text, { from: 'es', to: 'en' }).then((result: any) => {
+ const tb = this._sidebarTagRef.current as FormattedTextBox;
+ tb._editorView?.dispatch(tb._editorView!.state.tr.insertText(result1.text + '\r\n\r\n' + result.text));
}),
1000
);
@@ -1967,6 +1972,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent setupMoveUpEvents(this, e, returnFalse, emptyFunction, () => SelectionManager.SelectView(this.props.DocumentView?.()!, false), true)}>
);
};
return (
- {renderComponent(StrCast(this.layoutDoc.sidebar_collectionType))}
+ {renderComponent(StrCast(this.layoutDoc[this.SidebarKey + '_type_collection']))}
);
}
@@ -2044,9 +2050,24 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent
{
+ if (e.clientX > this.ProseRef!.getBoundingClientRect().right) {
+ if (this.rootDoc[this.SidebarKey + '_type_collection'] === CollectionViewType.Freeform) {
+ // if the scrolled freeform is a child of the sidebar component, we need to let the event go through
+ // so react can let the freeform view handle it. We prevent default to stop any containing views from scrolling
+ e.preventDefault();
+ }
+ return;
+ }
+
// if scrollTop is 0, then don't let wheel trigger scroll on any container (which it would since onScroll won't be triggered on this)
if (this.props.isContentActive() && !this.props.allowScroll) {
- if (!NumCast(this.layoutDoc._layout_scrollTop) && e.deltaY <= 0) e.preventDefault();
+ // prevent default if selected || child is active but this doc isn't scrollable
+ if (
+ (this._scrollRef.current?.scrollHeight ?? 0) <= Math.ceil(Number(this.layoutDoc._height)) && //
+ (this.props.isSelected() || this.isAnyChildContentActive())
+ ) {
+ e.preventDefault();
+ }
e.stopPropagation();
}
};
@@ -2120,7 +2141,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent
Date: Wed, 13 Sep 2023 14:13:45 -0400
Subject: fixed copying entire text box when nothing is selected.
---
src/client/views/nodes/formattedText/FormattedTextBox.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 7eab1ea4e..b60b5a2e3 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1826,7 +1826,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent i && node?.marks?.().some(mark => mark.type === schema.marks.user_mark && mark.attrs.userid !== Doc.CurrentUserEmail) && [AclAugment, AclSelfEdit].includes(GetEffectiveAcl(this.rootDoc))) {
@@ -1845,6 +1845,9 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent {
--
cgit v1.2.3-70-g09d2
From 94c62a71d1fc124891115b3bc36f4a565071d3d7 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Wed, 13 Sep 2023 15:13:53 -0400
Subject: removed leading/trailing spaces from published terms
---
src/client/views/nodes/formattedText/FormattedTextBox.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index b60b5a2e3..360dfca04 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -460,7 +460,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent FieldValue(this.dataDoc.title));
if (!(cfield instanceof ComputedField)) {
- this.dataDoc.title = prefix + str.substring(0, Math.min(40, str.length)) + (str.length > 40 ? '...' : '');
+ this.dataDoc.title = (prefix + str.substring(0, Math.min(40, str.length)) + (str.length > 40 ? '...' : '')).trim();
if (str.startsWith('@') && str.length > 1) {
Doc.AddDocToList(Doc.MyPublishedDocs, undefined, this.rootDoc);
}
--
cgit v1.2.3-70-g09d2
From 9bff82f5d53f7d13802f8affc4759db0953d7dc7 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Tue, 19 Sep 2023 14:15:52 -0400
Subject: made goldenlayout tabs/buttons follow color scheme + added hover
highlights. got rid of old color scheme code.
---
src/client/goldenLayout.js | 14 +-
src/client/util/CurrentUserUtils.ts | 14 +-
src/client/views/DocumentDecorations.tsx | 10 +-
src/client/views/MainView.scss | 90 +----
src/client/views/MainView.tsx | 9 +-
src/client/views/StyleProvider.tsx | 26 +-
.../views/collections/CollectionDockingView.scss | 396 +++++++++++++++++++--
.../views/collections/CollectionDockingView.tsx | 57 +--
src/client/views/collections/TabDocView.tsx | 1 +
.../CollectionFreeFormLayoutEngines.tsx | 2 +-
.../views/nodes/formattedText/DashDocView.tsx | 2 +-
src/mobile/MobileInterface.tsx | 5 +-
12 files changed, 448 insertions(+), 178 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/goldenLayout.js b/src/client/goldenLayout.js
index 843b8bb5f..00ec5e439 100644
--- a/src/client/goldenLayout.js
+++ b/src/client/goldenLayout.js
@@ -1606,10 +1606,10 @@
dragProxyHeight: 200
},
labels: {
- close: 'close',
- maximise: 'maximise',
+ close: 'close tab stack',
+ maximise: 'maximize stack',
minimise: 'minimise',
- popout: 'new tab',
+ popout: 'create new collection tab',
popin: 'pop in',
tabDropdown: 'additional tabs'
}
@@ -2922,7 +2922,7 @@
* @type {String}
*/
lm.controls.Tab._template = '' +
- '' +
+ '' +
'';
lm.utils.copy(lm.controls.Tab.prototype, {
@@ -5083,10 +5083,10 @@
'column',
'stack',
'component',
- 'close',
- 'maximise',
+ 'close tab stack',
+ 'maximize stack',
'minimise',
- 'new tab'
+ 'create new collection tab'
];
};
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 452bb74cd..2983d778f 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -476,7 +476,6 @@ export class CurrentUserUtils {
static setupDashboards(doc: Doc, field:string) {
var myDashboards = DocCast(doc[field]);
- const toggleDarkTheme = `this.colorScheme = this.colorScheme ? undefined : "${ColorScheme.Dark}"`;
const newDashboard = `createNewDashboard()`;
const reqdBtnOpts:DocumentOptions = { _forceActive: true, _width: 30, _height: 30, _dragOnlyWithinContainer: true, _layout_hideContextMenu: true,
@@ -487,10 +486,10 @@ export class CurrentUserUtils {
const contextMenuScripts = [/*newDashboard*/] as string[];
const contextMenuLabels = [/*"Create New Dashboard"*/] as string[];
const contextMenuIcons = [/*"plus"*/] as string[];
- const childContextMenuScripts = [toggleDarkTheme, `toggleComicMode()`, `snapshotDashboard()`, `shareDashboard(self)`, 'removeDashboard(self)', 'resetDashboard(self)']; // entries must be kept in synch with childContextMenuLabels, childContextMenuIcons, and childContextMenuFilters
- const childContextMenuFilters = ['!IsNoviceMode()', '!IsNoviceMode()', '!IsNoviceMode()', undefined as any, undefined as any, '!IsNoviceMode()'];// entries must be kept in synch with childContextMenuLabels, childContextMenuIcons, and childContextMenuScripts
- const childContextMenuLabels = ["Toggle Dark Theme", "Toggle Comic Mode", "Snapshot Dashboard", "Share Dashboard", "Remove Dashboard", "Reset Dashboard"];// entries must be kept in synch with childContextMenuScripts, childContextMenuIcons, and childContextMenuFilters
- const childContextMenuIcons = ["chalkboard", "tv", "camera", "users", "times", "trash"]; // entries must be kept in synch with childContextMenuScripts, childContextMenuLabels, and childContextMenuFilters
+ const childContextMenuScripts = [`toggleComicMode()`, `snapshotDashboard()`, `shareDashboard(self)`, 'removeDashboard(self)', 'resetDashboard(self)']; // entries must be kept in synch with childContextMenuLabels, childContextMenuIcons, and childContextMenuFilters
+ const childContextMenuFilters = ['!IsNoviceMode()', '!IsNoviceMode()', undefined as any, undefined as any, '!IsNoviceMode()'];// entries must be kept in synch with childContextMenuLabels, childContextMenuIcons, and childContextMenuScripts
+ const childContextMenuLabels = ["Toggle Comic Mode", "Snapshot Dashboard", "Share Dashboard", "Remove Dashboard", "Reset Dashboard"];// entries must be kept in synch with childContextMenuScripts, childContextMenuIcons, and childContextMenuFilters
+ const childContextMenuIcons = ["tv", "camera", "users", "times", "trash"]; // entries must be kept in synch with childContextMenuScripts, childContextMenuLabels, and childContextMenuFilters
const reqdOpts:DocumentOptions = {
title: "My Dashboards", childHideLinkButton: true, treeView_FreezeChildren: "remove|add", treeView_HideTitle: true, layout_boxShadow: "0 0", childDontRegisterViews: true,
dropAction: "same", treeView_Type: TreeViewType.fileSystem, isFolder: true, isSystem: true, treeView_TruncateTitleWidth: 350, ignoreClick: true,
@@ -892,7 +891,6 @@ export class CurrentUserUtils {
doc.defaultAclPrivate ?? (doc.defaultAclPrivate = false);
doc.savedFilters ?? (doc.savedFilters = new List());
doc.userBackgroundColor ?? (doc.userBackgroundColor = Colors.DARK_GRAY);
- addStyleSheetRule(SettingsManager._settingsStyle, 'lm_header', { background: `${doc.userBackgroundColor} !important` });
doc.userVariantColor ?? (doc.userVariantColor = Colors.MEDIUM_BLUE);
doc.userColor ?? (doc.userColor = Colors.LIGHT_GRAY);
doc.userTheme ?? (doc.userTheme = ColorScheme.Dark);
@@ -920,10 +918,6 @@ export class CurrentUserUtils {
Doc.GetProto(DocCast(Doc.UserDoc().emptyWebpage)).data = new WebField("https://www.wikipedia.org")
- if (doc.activeDashboard instanceof Doc) {
- // undefined means ColorScheme.Light until all CSS is updated with values for each color scheme (e.g., see MainView.scss, DocumentDecorations.scss)
- doc.activeDashboard.colorScheme = doc.activeDashboard.colorScheme === ColorScheme.Light ? undefined : doc.activeDashboard.colorScheme;
- }
new LinkManager();
DocServer.CacheNeedsUpdate && setTimeout(DocServer.UPDATE_SERVER_CACHE, 2500);
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 7e55b0ebc..327bb5585 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -804,8 +804,6 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
);
- const colorScheme = StrCast(Doc.ActiveDashboard?.colorScheme);
-
const leftBounds = this.props.boundsLeft;
const topBounds = LightboxView.LightboxDoc ? 0 : this.props.boundsTop;
bounds.x = Math.max(leftBounds, bounds.x - this._resizeBorderWidth / 2) + this._resizeBorderWidth / 2;
@@ -818,7 +816,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const useRotation = !hideResizers && seldocview.rootDoc.type !== DocumentType.EQUATION && seldocview.props.CollectionFreeFormDocumentView; // when do we want an object to not rotate?
const rotation = SelectionManager.Views().length == 1 ? NumCast(seldocview.rootDoc._rotation) : 0;
- const resizerScheme = colorScheme ? 'documentDecorations-resizer' + colorScheme : '';
+ const resizerScheme = '';
// Radius constants
const useRounding = seldocview.ComponentView instanceof ImageBox || seldocview.ComponentView instanceof FormattedTextBox || seldocview.ComponentView instanceof CollectionFreeFormView;
@@ -853,7 +851,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
const titleArea = this._editingTitle ? (
{hideTitle ? null : (
-
+
{this.selectionTitle}
)}
@@ -887,7 +885,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
);
return (
-
+
;
@computed private get mainContainer() {
if (window.location.pathname.startsWith('/doc/') && Doc.CurrentUserEmail === 'guest') {
@@ -800,7 +797,7 @@ export class MainView extends React.Component {
return (
<>
{this._hideUI ? null : this.leftMenuPanel}
-
+
{this.flyout}
@@ -1003,7 +1000,7 @@ export class MainView extends React.Component {
render() {
return (
@@ -135,7 +131,7 @@ export function DefaultStyleProvider(doc: Opt
, props: Opt, props: Opt, props: Opt 0 ? Doc.UserDoc().activeCollectionNestedBackground : Doc.UserDoc().activeCollectionBackground, 'string') ?? (darkScheme() ? Colors.BLACK : Colors.MEDIUM_GRAY));
+ (Colors.DARK_GRAY)
+ : Cast((props?.renderDepth || 0) > 0 ? Doc.UserDoc().activeCollectionNestedBackground : Doc.UserDoc().activeCollectionBackground, 'string') ?? (Colors.MEDIUM_GRAY));
break;
//if (doc._type_collection !== CollectionViewType.Freeform && doc._type_collection !== CollectionViewType.Time) return "rgb(62,62,62)";
- default: docColor = docColor || (darkScheme() ? Colors.DARK_GRAY : Colors.WHITE);
+ default: docColor = docColor || (Colors.WHITE);
}
return (docColor && !doc) ? DashColor(docColor).fade(0.5).toString() : docColor;
}
@@ -247,7 +243,7 @@ export function DefaultStyleProvider(doc: Opt, props: Opt .lm_item {
+ float: left;
+}
+.lm_content {
+ overflow: hidden;
+ position: relative;
+}
+.lm_dragging,
+.lm_dragging * {
+ cursor: move !important;
+ user-select: none;
+}
+.lm_maximised {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 40;
+}
+.lm_maximise_placeholder {
+ display: none;
+}
+.lm_splitter {
+ position: relative;
+ z-index: 20;
+}
+.lm_splitter:hover,
+.lm_splitter.lm_dragging {
+ background: orange;
+}
+.lm_splitter.lm_vertical .lm_drag_handle {
+ width: 100%;
+ position: absolute;
+ cursor: ns-resize;
+}
+.lm_splitter.lm_horizontal {
+ float: left;
+ height: 100%;
+}
+.lm_splitter.lm_horizontal .lm_drag_handle {
+ height: 100%;
+ position: absolute;
+ cursor: ew-resize;
+}
+.lm_header {
+ overflow: visible;
+ position: relative;
+ z-index: 1;
+}
+// .lm_header [class^='lm_'] {
+// box-sizing: content-box !important;
+// }
+.lm_header .lm_controls {
+ position: absolute;
+ right: 3px;
+}
+.lm_header .lm_controls > li {
+ cursor: pointer;
+ float: left;
+ width: 18px;
+ height: 18px;
+ text-align: center;
+}
+.lm_header ul {
+ margin: 0;
+ padding: 0;
+ list-style-type: none;
+}
+.lm_header .lm_tabs {
+ position: absolute;
+}
+.lm_header .lm_tab {
+ cursor: pointer;
+ float: left;
+ height: 25px;
+ padding: 0 10px 5px;
+ padding-right: 25px;
+ position: relative;
+ box-shadow: unset !important;
+}
+.lm_header .lm_tab i {
+ width: 2px;
+ height: 19px;
+ position: absolute;
+}
+.lm_header .lm_tab i.lm_left {
+ top: 0;
+ left: -2px;
+}
+.lm_header .lm_tab i.lm_right {
+ top: 0;
+ right: -2px;
+}
+.lm_header .lm_tab .lm_title {
+ display: inline-block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.lm_header .lm_tab .lm_close_tab {
+ width: 14px;
+ height: 14px;
+ position: absolute;
+ top: 0;
+ right: 0;
+ text-align: center;
+}
+.lm_stack.lm_left .lm_header,
+.lm_stack.lm_right .lm_header {
+ height: 100%;
+}
+.lm_dragProxy.lm_left .lm_header,
+.lm_dragProxy.lm_right .lm_header,
+.lm_stack.lm_left .lm_header,
+.lm_stack.lm_right .lm_header {
+ width: 20px;
+ float: left;
+ vertical-align: top;
+}
+.lm_dragProxy.lm_left .lm_header .lm_tabs,
+.lm_dragProxy.lm_right .lm_header .lm_tabs,
+.lm_stack.lm_left .lm_header .lm_tabs,
+.lm_stack.lm_right .lm_header .lm_tabs {
+ transform-origin: left top;
+ top: 0;
+ width: 1000px;
+}
+.lm_dragProxy.lm_left .lm_header .lm_controls,
+.lm_dragProxy.lm_right .lm_header .lm_controls,
+.lm_stack.lm_left .lm_header .lm_controls,
+.lm_stack.lm_right .lm_header .lm_controls {
+ bottom: 0;
+}
+.lm_dragProxy.lm_left .lm_items,
+.lm_dragProxy.lm_right .lm_items,
+.lm_stack.lm_left .lm_items,
+.lm_stack.lm_right .lm_items {
+ float: left;
+}
+.lm_dragProxy.lm_left .lm_header .lm_tabs,
+.lm_stack.lm_left .lm_header .lm_tabs {
+ transform: rotate(-90deg) scaleX(-1);
+ left: 0;
+}
+.lm_dragProxy.lm_left .lm_header .lm_tabs .lm_tab,
+.lm_stack.lm_left .lm_header .lm_tabs .lm_tab {
+ transform: scaleX(-1);
+ margin-top: 1px;
+}
+.lm_dragProxy.lm_left .lm_header .lm_tabdropdown_list,
+.lm_stack.lm_left .lm_header .lm_tabdropdown_list {
+ top: initial;
+ right: initial;
+ left: 20px;
+}
+.lm_dragProxy.lm_right .lm_content {
+ float: left;
+}
+.lm_dragProxy.lm_right .lm_header .lm_tabs,
+.lm_stack.lm_right .lm_header .lm_tabs {
+ transform: rotate(90deg) scaleX(1);
+ left: 100%;
+ margin-left: 0;
+}
+.lm_dragProxy.lm_right .lm_header .lm_controls,
+.lm_stack.lm_right .lm_header .lm_controls {
+ left: 3px;
+}
+.lm_dragProxy.lm_right .lm_header .lm_tabdropdown_list,
+.lm_stack.lm_right .lm_header .lm_tabdropdown_list {
+ top: initial;
+ right: 20px;
+}
+.lm_dragProxy.lm_bottom .lm_header .lm_tab,
+.lm_stack.lm_bottom .lm_header .lm_tab {
+ margin-top: 0;
+ border-top: none;
+}
+.lm_dragProxy.lm_bottom .lm_header .lm_controls,
+.lm_stack.lm_bottom .lm_header .lm_controls {
+ top: 3px;
+}
+.lm_dragProxy.lm_bottom .lm_header .lm_tabdropdown_list,
+.lm_stack.lm_bottom .lm_header .lm_tabdropdown_list {
+ top: initial;
+ bottom: 20px;
+}
+.lm_drop_tab_placeholder {
+ float: left;
+ width: 100px;
+ height: 10px;
+ visibility: hidden;
+}
+.lm_header .lm_controls .lm_tabdropdown:before {
+ content: '';
+ width: 0;
+ height: 0;
+ vertical-align: middle;
+ display: inline-block;
+ border-top: 5px dashed;
+ border-right: 5px solid transparent;
+ border-left: 5px solid transparent;
+ color: white;
+}
+.lm_header .lm_tabdropdown_list {
+ position: absolute;
+ top: 20px;
+ right: 0;
+ z-index: 5;
+ overflow: hidden;
+}
+.lm_header .lm_tabdropdown_list .lm_tab {
+ clear: both;
+ padding-right: 10px;
+ margin: 0;
+}
+.lm_header .lm_tabdropdown_list .lm_tab .lm_title {
+ width: 100px;
+}
+.lm_header .lm_tabdropdown_list .lm_close_tab {
+ display: none !important;
+}
+.lm_dragProxy {
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 30;
+}
+.lm_dragProxy .lm_header {
+ background: transparent;
+}
+.lm_dragProxy .lm_content {
+ border-top: none;
+ overflow: hidden;
+}
+.lm_dropTargetIndicator {
+ display: none;
+ position: absolute;
+ z-index: 20;
+}
+.lm_dropTargetIndicator .lm_inner {
+ width: 100%;
+ height: 100%;
+ position: relative;
+ top: 0;
+ left: 0;
+}
+.lm_transition_indicator {
+ display: none;
+ width: 20px;
+ height: 20px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ z-index: 20;
+}
+.lm_popin {
+ width: 20px;
+ height: 20px;
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ z-index: 9999;
+}
+.lm_popin > * {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+}
+.lm_popin > .lm_bg {
+ z-index: 10;
+}
+.lm_popin > .lm_icon {
+ z-index: 20;
+} /*# sourceMappingURL=goldenlayout-base.css.map */
+
@import '../../../../node_modules/golden-layout/src/css/goldenlayout-dark-theme.css';
.lm_title {
@@ -46,18 +325,33 @@
// font-weight: 700;
}
+.lm_header .lm_tabs {
+ overflow-y: hidden;
+ width: 100%;
+}
+ul.lm_tabs::before {
+ content: ' ';
+ position: absolute;
+ bottom: 0;
+ width: 100%;
+ z-index: 1;
+ pointer-events: none;
+ border: solid 1px black;
+}
.lm_header .lm_tab {
// padding: 0px; // moved to MainView.scss, othwerise they get overridden by default stylings
// opacity: 0.7;
// box-shadow: none;
// height: 25px;
// border-bottom: black solid;
+ border-bottom: unset !important;
+ border-top-right-radius: 5px;
+ border-top-left-radius: 5px;
.collectionDockingView-gear {
display: none;
}
}
-
.lm_header .lm_tab.lm_active {
padding: 0;
opacity: 1;
@@ -65,7 +359,11 @@
box-shadow: none;
height: 27px;
margin-right: 2px;
- // border-bottom: unset;
+ z-index: 2 !important;
+ border-right: solid 2px;
+ border-left: solid 2px;
+ border-top: solid 2px;
+ border-color: black;
.collectionDockingView-gear {
display: inline-block;
@@ -123,20 +421,63 @@
}
.lm_close_tab {
+ display: inline-flex !important;
+ opacity: 0 !important;
padding: 0;
align-self: center;
margin-right: 5px;
- background-color: black;
border-radius: 3px;
- opacity: 1 !important;
width: 15px !important;
height: 15px !important;
position: relative !important;
- display: inline-flex !important;
align-items: center;
top: 0 !important;
right: unset !important;
left: 0 !important;
+ background-image: unset !important;
+ &::before {
+ content: 'x';
+ color: rgb(50, 50, 50);
+ margin: auto;
+ position: relative;
+ top: -2px;
+ }
+ &:hover {
+ display: inline-flex !important;
+ &::before {
+ color: white;
+ }
+ }
+}
+.lm_close {
+ background-image: unset !important;
+ &:hover {
+ background: gray;
+ color: white !important;
+ }
+ &::before {
+ content: 'x';
+ margin: auto;
+ position: relative;
+ top: -2;
+ font-size: medium;
+ font-family: sans-serif;
+ }
+}
+.lm_active .lm_close_tab {
+ opacity: 1 !important;
+}
+.lm_tab:hover {
+ .lm_close_tab {
+ opacity: 1 !important;
+ }
+}
+
+.lm_iconWrap {
+ &:hover {
+ background: gray;
+ color: white !important;
+ }
}
.lm_tab,
@@ -154,14 +495,6 @@
top: 0;
left: 0;
- // overflow: hidden; // bcz: menus don't show up when this is on (e.g., the parentSelectorMenu)
- .collectionDockingView-gear {
- padding-left: 5px;
- height: 15px;
- width: 18px;
- margin: auto;
- }
-
.collectionDockingView-drag {
touch-action: none;
position: absolute;
@@ -180,7 +513,6 @@
display: flex;
align-content: center;
justify-content: center;
- background: $dark-gray;
}
.lm_controls > li {
@@ -190,14 +522,38 @@
}
.lm_controls .lm_popout {
- transform: rotate(45deg);
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAQUlEQVR4nHXOQQ4AMAgCQeT/f6aXpsGK3jSTuCVJAAr7iBdoAwCKd0nwfaAdHbYERw5b44+E8JoBjEYGMBq5gAYP3usUDu2IvoUAAAAASUVORK5CYII=);
+ background-image: unset;
+ left: -3;
+ &:hover {
+ background: gray;
+ color: white !important;
+ }
+ }
+ li.lm_popout::before {
+ content: '+';
+ margin: auto;
+ font-size: x-large;
+ top: -8;
+ position: relative;
+ }
+ .lm_maximise {
+ background-image: unset !important;
+ &::before {
+ content: '\25A3';
+ margin: auto;
+ font-size: medium;
+ position: relative;
+ }
+ &:hover {
+ background: gray;
+ color: white !important;
+ }
}
.lm_maximised .lm_controls .lm_maximise {
- opacity: 1;
- transform: scale(0.8);
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAAKElEQVR4nGP8////fwYCgImQAgYGBgYWKM2IR81/okwajIpgvsMbVgAwgQYRVakEKQAAAABJRU5ErkJggg==) !important;
+ &::before {
+ content: '\25A2';
+ }
}
.flexlayout__layout {
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 8472c59db..4873a61ff 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -10,7 +10,7 @@ import { List } from '../../../fields/List';
import { ImageCast, NumCast, StrCast } from '../../../fields/Types';
import { ImageField } from '../../../fields/URLField';
import { GetEffectiveAcl, inheritParentAcls } from '../../../fields/util';
-import { emptyFunction, incrementTitleCopy } from '../../../Utils';
+import { addStyleSheet, addStyleSheetRule, clearStyleSheetRules, emptyFunction, incrementTitleCopy } from '../../../Utils';
import { DocServer } from '../../DocServer';
import { Docs } from '../../documents/Documents';
import { CollectionViewType, DocumentType } from '../../documents/DocumentTypes';
@@ -31,6 +31,7 @@ import { CollectionFreeFormView } from './collectionFreeForm';
import { CollectionSubView, SubCollectionViewProps } from './CollectionSubView';
import { TabDocView } from './TabDocView';
import React = require('react');
+import { SettingsManager } from '../../util/SettingsManager';
const _global = (window /* browser */ || global) /* node */ as any;
@observer
@@ -60,7 +61,7 @@ export class CollectionDockingView extends CollectionSubView() {
return this._goldenLayout._maximisedItem !== null;
}
private _goldenLayout: any = null;
-
+ static _highlightStyleSheet: any = addStyleSheet();
constructor(props: SubCollectionViewProps) {
super(props);
if (this.props.renderDepth < 0) runInAction(() => (CollectionDockingView.Instance = this));
@@ -330,6 +331,16 @@ export class CollectionDockingView extends CollectionSubView() {
width => !this._goldenLayout && width > 20 && setTimeout(() => this.setupGoldenLayout()), // need to wait for the collectiondockingview-container to have it's width/height since golden layout reads that to configure its windows
{ fireImmediately: true }
);
+ reaction(
+ () => [SettingsManager.userBackgroundColor, SettingsManager.userBackgroundColor],
+ () => {
+ clearStyleSheetRules(CollectionDockingView._highlightStyleSheet);
+ addStyleSheetRule(CollectionDockingView._highlightStyleSheet, 'lm_controls', { background: `${SettingsManager.userBackgroundColor} !important` });
+ addStyleSheetRule(CollectionDockingView._highlightStyleSheet, 'lm_controls', { color: `${SettingsManager.userColor} !important` });
+ addStyleSheetRule(SettingsManager._settingsStyle, 'lm_header', { background: `${SettingsManager.userBackgroundColor} !important` });
+ },
+ { fireImmediately: true }
+ );
}
};
@@ -505,6 +516,23 @@ export class CollectionDockingView extends CollectionSubView() {
}
});
+ let addNewDoc = action(() => {
+ const dashboard = Doc.ActiveDashboard;
+ if (dashboard) {
+ dashboard['pane-count'] = NumCast(dashboard['pane-count']) + 1;
+ const docToAdd = Docs.Create.FreeformDocument([], {
+ _width: this.props.PanelWidth(),
+ _height: this.props.PanelHeight(),
+ _layout_fitWidth: true,
+ _freeform_backgroundGrid: true,
+ title: `Untitled Tab ${NumCast(dashboard['pane-count'])}`,
+ });
+ Doc.AddDocToList(Doc.MyHeaderBar, 'data', docToAdd);
+ inheritParentAcls(this.dataDoc, docToAdd, false);
+ CollectionDockingView.AddSplit(docToAdd, OpenWhereMod.none, stack);
+ }
+ });
+
stack.header?.controlsContainer
.find('.lm_close') //get the close icon
.off('click') //unbind the current click handler
@@ -524,31 +552,18 @@ export class CollectionDockingView extends CollectionSubView() {
})
);
+ stack.element.click((e: any) => {
+ if (stack.contentItems.length === 0 && Array.from(document.elementsFromPoint(e.originalEvent.x, e.originalEvent.y)).some(ele => ele?.className === 'empty-tabs-message')) {
+ addNewDoc();
+ }
+ });
stack.header?.controlsContainer
.find('.lm_maximise') //get the close icon
.click(() => setTimeout(this.stateChanged));
stack.header?.controlsContainer
.find('.lm_popout') //get the popout icon
.off('click') //unbind the current click handler
- .click(
- action(() => {
- // stack.config.fixed = !stack.config.fixed; // force the stack to have a fixed size
- const dashboard = Doc.ActiveDashboard;
- if (dashboard) {
- dashboard['pane-count'] = NumCast(dashboard['pane-count']) + 1;
- const docToAdd = Docs.Create.FreeformDocument([], {
- _width: this.props.PanelWidth(),
- _height: this.props.PanelHeight(),
- _layout_fitWidth: true,
- _freeform_backgroundGrid: true,
- title: `Untitled Tab ${NumCast(dashboard['pane-count'])}`,
- });
- Doc.AddDocToList(Doc.MyHeaderBar, 'data', docToAdd);
- inheritParentAcls(this.dataDoc, docToAdd, false);
- CollectionDockingView.AddSplit(docToAdd, OpenWhereMod.none, stack);
- }
- })
- );
+ .click(addNewDoc);
};
render() {
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index dab53b671..26aa5a121 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -132,6 +132,7 @@ export class TabDocView extends React.Component {
if (tab.element[0].children[1].children.length === 1) {
iconWrap.className = 'lm_iconWrap lm_moreInfo';
+ iconWrap.title = 'click for menu, drag to embed in document';
const dragBtnDown = (e: React.PointerEvent) => {
setupMoveUpEvents(
this,
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
index 1e76d373c..15b6e1d37 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
@@ -350,7 +350,7 @@ export function computeTimelineLayout(poolData: Map, pivotDoc:
groupNames.push({ type: 'text', text: toLabel(Math.ceil(maxTime)), x: Math.ceil(maxTime - minTime) * scaling, y: 0, height: fontHeight, fontSize, payload: undefined });
}
- const divider = { type: 'div', color: Doc.ActiveDashboard?.colorScheme === ColorScheme.Dark ? 'dimgray' : 'black', x: 0, y: 0, width: panelDim[0], height: -1, payload: undefined };
+ const divider = { type: 'div', color: 'black', x: 0, y: 0, width: panelDim[0], height: -1, payload: undefined };
return normalizeResults(panelDim, fontHeight, docMap, poolData, viewDefsToJSX, groupNames, (maxTime - minTime) * scaling, [divider]);
function layoutDocsAtTime(keyDocs: Doc[], key: number) {
diff --git a/src/client/views/nodes/formattedText/DashDocView.tsx b/src/client/views/nodes/formattedText/DashDocView.tsx
index 48f4c2afd..5349e6966 100644
--- a/src/client/views/nodes/formattedText/DashDocView.tsx
+++ b/src/client/views/nodes/formattedText/DashDocView.tsx
@@ -22,7 +22,7 @@ export class DashDocView {
this.dom = document.createElement('span');
this.dom.style.position = 'relative';
this.dom.style.textIndent = '0';
- this.dom.style.border = '1px solid ' + StrCast(tbox.layoutDoc.color, Doc.ActiveDashboard?.colorScheme === ColorScheme.Dark ? 'dimgray' : 'lightGray');
+ this.dom.style.border = '1px solid ' + StrCast(tbox.layoutDoc.color, 'lightGray');
this.dom.style.width = node.attrs.width;
this.dom.style.height = node.attrs.height;
this.dom.style.display = node.attrs.hidden ? 'none' : 'inline-block';
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index c16a1c124..498bec6ed 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -588,11 +588,10 @@ export class MobileInterface extends React.Component {
const freeformDoc = Doc.GuestTarget || Docs.Create.FreeformDocument([], freeformOptions);
const dashboardDoc = Docs.Create.StandardCollectionDockingDocument([{ doc: freeformDoc, initialWidth: 600 }], { title: `Dashboard ${dashboardCount}` }, id, 'row');
- const toggleTheme = ScriptField.MakeScript(`self.colorScheme = self.colorScheme ? undefined: ${ColorScheme.Dark}}`);
const toggleComic = ScriptField.MakeScript(`toggleComicMode()`);
const cloneDashboard = ScriptField.MakeScript(`cloneDashboard()`);
- dashboardDoc.contextMenuScripts = new List([toggleTheme!, toggleComic!, cloneDashboard!]);
- dashboardDoc.contextMenuLabels = new List(['Toggle Theme Colors', 'Toggle Comic Mode', 'New Dashboard Layout']);
+ dashboardDoc.contextMenuScripts = new List([toggleComic!, cloneDashboard!]);
+ dashboardDoc.contextMenuLabels = new List(['Toggle Comic Mode', 'New Dashboard Layout']);
Doc.AddDocToList(scens, 'data', dashboardDoc);
};
--
cgit v1.2.3-70-g09d2
From f4af59c20fe64cfb5f2a034546520484788033d9 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Tue, 19 Sep 2023 15:27:30 -0400
Subject: fixed issue with clicking at end of text range selecting list_item,
not text causing bulleted items to behave weirdly.
---
src/client/views/nodes/formattedText/FormattedTextBox.tsx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 360dfca04..6a92d09d9 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1637,8 +1637,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent 0 && !state.doc.resolve(xpos).node()?.isTextblock) {
+ xpos = xpos - 1;
+ }
+ editor.dispatch(state.tr.setSelection(new TextSelection(state.doc.resolve(xpos))));
let target = e.target as any; // hrefs are stored on the dataset of the node that wraps the hyerlink
while (target && !target.dataset?.targethrefs) target = target.parentElement;
FormattedTextBoxComment.update(this, editor, undefined, target?.dataset?.targethrefs, target?.dataset.linkdoc, target?.dataset.nopreview === 'true');
--
cgit v1.2.3-70-g09d2
From c9ce658d193d5e8ec4161c31bc60c499ada1b8b7 Mon Sep 17 00:00:00 2001
From: bobzel
Date: Tue, 19 Sep 2023 16:28:40 -0400
Subject: fixed tree view hierarchy opening icons
---
src/client/views/collections/TreeView.scss | 4 +++-
src/client/views/collections/TreeView.tsx | 2 +-
src/client/views/nodes/formattedText/DashDocView.tsx | 1 -
3 files changed, 4 insertions(+), 3 deletions(-)
(limited to 'src/client/views/nodes/formattedText')
diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss
index 0cc11bf1c..cbcc7c710 100644
--- a/src/client/views/collections/TreeView.scss
+++ b/src/client/views/collections/TreeView.scss
@@ -21,7 +21,7 @@
}
.treeView-bulletIcons {
- width: 100%;
+ margin: auto;
height: 100%;
// changes start here.
@@ -64,6 +64,8 @@
position: relative;
width: fit-content;
min-height: 20px;
+ min-width: 15px;
+ margin-right: 3px;
color: $medium-gray;
border: #80808030 1px solid;
border-radius: 5px;
diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx
index 832e102bc..cd526c77e 100644
--- a/src/client/views/collections/TreeView.tsx
+++ b/src/client/views/collections/TreeView.tsx
@@ -761,7 +761,7 @@ export class TreeView extends React.Component {
} size={Size.XSMALL} />
)
) : (
-