aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-09-12 12:09:03 -0400
committerbobzel <zzzman@gmail.com>2022-09-12 12:09:03 -0400
commit13e0ac912beeab64a859b3463953774f3f1676f1 (patch)
tree7966d258922ac9ce71d8cf7818c05c41def0f666
parentf847c6d554f9dcecbd6c3024f712510f341daf67 (diff)
fixed h1 style for use in text boxes with #,## etc markdown. made %[tix!] text tags reset user_mark to current time.
-rw-r--r--src/client/views/DictationOverlay.tsx60
-rw-r--r--src/client/views/LightboxView.tsx1
-rw-r--r--src/client/views/MainView.scss5
-rw-r--r--src/client/views/MainView.tsx1
-rw-r--r--src/client/views/PreviewCursor.scss5
-rw-r--r--src/client/views/PreviewCursor.tsx3
-rw-r--r--src/client/views/nodes/formattedText/RichTextRules.ts10
-rw-r--r--src/debug/Viewer.tsx72
8 files changed, 86 insertions, 71 deletions
diff --git a/src/client/views/DictationOverlay.tsx b/src/client/views/DictationOverlay.tsx
index f4f96da8a..0bdcdc303 100644
--- a/src/client/views/DictationOverlay.tsx
+++ b/src/client/views/DictationOverlay.tsx
@@ -1,9 +1,8 @@
import { computed, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
-import "normalize.css";
import * as React from 'react';
import { DictationManager } from '../util/DictationManager';
-import "./Main.scss";
+import './Main.scss';
import { MainViewModal } from './MainViewModal';
@observer
@@ -29,44 +28,53 @@ export class DictationOverlay extends React.Component {
this.dictationOverlayVisible = false;
this.dictationSuccess = undefined;
DictationOverlay.Instance.hasActiveModal = false;
- setTimeout(() => this.dictatedPhrase = DictationManager.placeholder, 500);
+ setTimeout(() => (this.dictatedPhrase = DictationManager.placeholder), 500);
}, duration);
- }
+ };
public cancelDictationFade = () => {
if (this.overlayTimeout) {
clearTimeout(this.overlayTimeout);
this.overlayTimeout = undefined;
}
- }
+ };
- @computed public get dictatedPhrase() { return this._dictationState; }
- @computed public get dictationSuccess() { return this._dictationSuccessState; }
- @computed public get dictationOverlayVisible() { return this._dictationDisplayState; }
- @computed public get isListening() { return this._dictationListeningState; }
+ @computed public get dictatedPhrase() {
+ return this._dictationState;
+ }
+ @computed public get dictationSuccess() {
+ return this._dictationSuccessState;
+ }
+ @computed public get dictationOverlayVisible() {
+ return this._dictationDisplayState;
+ }
+ @computed public get isListening() {
+ return this._dictationListeningState;
+ }
- public set dictatedPhrase(value: string) { runInAction(() => this._dictationState = value); }
- public set dictationSuccess(value: boolean | undefined) { runInAction(() => this._dictationSuccessState = value); }
- public set dictationOverlayVisible(value: boolean) { runInAction(() => this._dictationDisplayState = value); }
- public set isListening(value: DictationManager.Controls.ListeningUIStatus) { runInAction(() => this._dictationListeningState = value); }
+ public set dictatedPhrase(value: string) {
+ runInAction(() => (this._dictationState = value));
+ }
+ public set dictationSuccess(value: boolean | undefined) {
+ runInAction(() => (this._dictationSuccessState = value));
+ }
+ public set dictationOverlayVisible(value: boolean) {
+ runInAction(() => (this._dictationDisplayState = value));
+ }
+ public set isListening(value: DictationManager.Controls.ListeningUIStatus) {
+ runInAction(() => (this._dictationListeningState = value));
+ }
render() {
const success = this.dictationSuccess;
const result = this.isListening && !this.isListening.interim ? DictationManager.placeholder : `"${this.dictatedPhrase}"`;
const dialogueBoxStyle = {
- background: success === undefined ? "gainsboro" : success ? "lawngreen" : "red",
- borderColor: this.isListening ? "red" : "black",
- fontStyle: "italic"
+ background: success === undefined ? 'gainsboro' : success ? 'lawngreen' : 'red',
+ borderColor: this.isListening ? 'red' : 'black',
+ fontStyle: 'italic',
};
const overlayStyle = {
- backgroundColor: this.isListening ? "red" : "darkslategrey"
+ backgroundColor: this.isListening ? 'red' : 'darkslategrey',
};
- return (<MainViewModal
- contents={result}
- isDisplayed={this.dictationOverlayVisible}
- interactive={false}
- dialogueBoxStyle={dialogueBoxStyle}
- overlayStyle={overlayStyle}
- closeOnExternalClick={this.initiateDictationFade}
- />);
+ return <MainViewModal contents={result} isDisplayed={this.dictationOverlayVisible} interactive={false} dialogueBoxStyle={dialogueBoxStyle} overlayStyle={overlayStyle} closeOnExternalClick={this.initiateDictationFade} />;
}
-} \ No newline at end of file
+}
diff --git a/src/client/views/LightboxView.tsx b/src/client/views/LightboxView.tsx
index 5613e82fb..cb5094f4b 100644
--- a/src/client/views/LightboxView.tsx
+++ b/src/client/views/LightboxView.tsx
@@ -1,7 +1,6 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, observable } from 'mobx';
import { observer } from 'mobx-react';
-import 'normalize.css';
import * as React from 'react';
import { Doc, DocListCast, Opt } from '../../fields/Doc';
import { InkTool } from '../../fields/InkField';
diff --git a/src/client/views/MainView.scss b/src/client/views/MainView.scss
index da79d2992..c5ac1cf52 100644
--- a/src/client/views/MainView.scss
+++ b/src/client/views/MainView.scss
@@ -1,5 +1,10 @@
@import 'global/globalCssVariables';
@import 'nodeModuleOverrides';
+h1,
+.h1 {
+ // reverts change to h1 made by normalize.css
+ font-size: 36px;
+}
.dash-tooltip {
font-size: 11px;
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index d7b526d22..24dae8816 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -5,6 +5,7 @@ import * as fa from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, configure, observable, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
+import 'normalize.css';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Doc, DocListCast, Opt } from '../../fields/Doc';
diff --git a/src/client/views/PreviewCursor.scss b/src/client/views/PreviewCursor.scss
index 60b7d14a0..7be765ea9 100644
--- a/src/client/views/PreviewCursor.scss
+++ b/src/client/views/PreviewCursor.scss
@@ -1,11 +1,10 @@
-
.previewCursor-Dark,
.previewCursor {
color: black;
position: absolute;
transform-origin: left top;
top: 0;
- left:0;
+ left: 0;
pointer-events: none;
opacity: 1;
z-index: 1001;
@@ -13,4 +12,4 @@
.previewCursor-Dark {
color: white;
-} \ No newline at end of file
+}
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index 4c17d5a97..d56d2a310 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -1,10 +1,9 @@
import { action, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
-import 'normalize.css';
import * as React from 'react';
import { Doc } from '../../fields/Doc';
import { Cast, NumCast, StrCast } from '../../fields/Types';
-import { emptyFunction, returnFalse } from '../../Utils';
+import { returnFalse } from '../../Utils';
import { DocServer } from '../DocServer';
import { Docs, DocumentOptions, DocUtils } from '../documents/Documents';
import { Transform } from '../util/Transform';
diff --git a/src/client/views/nodes/formattedText/RichTextRules.ts b/src/client/views/nodes/formattedText/RichTextRules.ts
index 2097b321f..2eb62c38d 100644
--- a/src/client/views/nodes/formattedText/RichTextRules.ts
+++ b/src/client/views/nodes/formattedText/RichTextRules.ts
@@ -343,8 +343,14 @@ export class RichTextRules {
const node = (state.doc.resolve(start) as any).nodeAfter;
if (node?.marks.findIndex((m: any) => m.type === schema.marks.user_tag) !== -1) return state.tr.removeMark(start, end, schema.marks.user_tag);
-
- return node ? state.tr.addMark(start, end, schema.marks.user_tag.create({ userid: Doc.CurrentUserEmail, tag: tag, modified: Math.round(Date.now() / 1000 / 60) })) : state.tr;
+ if (node?.marks.findIndex((m: any) => m.type === schema.marks.user_mark) !== -1) {
+ }
+ return node
+ ? state.tr
+ .removeMark(start, end, schema.marks.user_mark)
+ .addMark(start, end, schema.marks.user_mark.create({ userid: Doc.CurrentUserEmail, modified: Math.floor(Date.now() / 1000) }))
+ .addMark(start, end, schema.marks.user_tag.create({ userid: Doc.CurrentUserEmail, tag: tag, modified: Math.round(Date.now() / 1000 / 60) }))
+ : state.tr;
}),
new InputRule(new RegExp(/%\(/), (state, match, start, end) => {
diff --git a/src/debug/Viewer.tsx b/src/debug/Viewer.tsx
index ee7dd1fc1..02038c426 100644
--- a/src/debug/Viewer.tsx
+++ b/src/debug/Viewer.tsx
@@ -1,5 +1,4 @@
import { action, configure, observable, ObservableMap, Lambda } from 'mobx';
-import "normalize.css";
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { observer } from 'mobx-react';
@@ -21,7 +20,6 @@ URLField;
ScriptField;
CursorField;
-
function applyToDoc(doc: { [index: string]: FieldResult }, key: string, scriptString: string): boolean;
function applyToDoc(doc: { [index: number]: FieldResult }, key: number, scriptString: string): boolean;
function applyToDoc(doc: any, key: string | number, scriptString: string): boolean {
@@ -37,11 +35,11 @@ function applyToDoc(doc: any, key: string | number, scriptString: string): boole
}
configure({
- enforceActions: "observed"
+ enforceActions: 'observed',
});
@observer
-class ListViewer extends React.Component<{ field: List<Field> }>{
+class ListViewer extends React.Component<{ field: List<Field> }> {
@observable
expanded = false;
@@ -49,14 +47,16 @@ class ListViewer extends React.Component<{ field: List<Field> }>{
onClick = (e: React.MouseEvent) => {
this.expanded = !this.expanded;
e.stopPropagation();
- }
+ };
render() {
let content;
if (this.expanded) {
content = (
<div>
- {this.props.field.map((field, index) => <DebugViewer field={field} key={index} setValue={value => applyToDoc(this.props.field, index, value)} />)}
+ {this.props.field.map((field, index) => (
+ <DebugViewer field={field} key={index} setValue={value => applyToDoc(this.props.field, index, value)} />
+ ))}
</div>
);
} else {
@@ -66,7 +66,7 @@ class ListViewer extends React.Component<{ field: List<Field> }>{
<div>
<button onClick={this.onClick}>Toggle</button>
{content}
- </div >
+ </div>
);
}
}
@@ -80,7 +80,7 @@ class DocumentViewer extends React.Component<{ field: Doc }> {
onClick = (e: React.MouseEvent) => {
this.expanded = !this.expanded;
e.stopPropagation();
- }
+ };
render() {
let content;
@@ -96,10 +96,7 @@ class DocumentViewer extends React.Component<{ field: Doc }> {
});
content = (
<div>
- Document ({this.props.field[Id]})
- <div style={{ paddingLeft: "25px" }}>
- {fields}
- </div>
+ Document ({this.props.field[Id]})<div style={{ paddingLeft: '25px' }}>{fields}</div>
</div>
);
} else {
@@ -109,24 +106,23 @@ class DocumentViewer extends React.Component<{ field: Doc }> {
<div>
<button onClick={this.onClick}>Toggle</button>
{content}
- </div >
+ </div>
);
}
}
@observer
-class DebugViewer extends React.Component<{ field: FieldResult, setValue(value: string): boolean }> {
-
+class DebugViewer extends React.Component<{ field: FieldResult; setValue(value: string): boolean }> {
render() {
let content;
const field = this.props.field;
if (field instanceof List) {
- content = (<ListViewer field={field} />);
+ content = <ListViewer field={field} />;
} else if (field instanceof Doc) {
- content = (<DocumentViewer field={field} />);
- } else if (typeof field === "string") {
+ content = <DocumentViewer field={field} />;
+ } else if (typeof field === 'string') {
content = <p>"{field}"</p>;
- } else if (typeof field === "number" || typeof field === "boolean") {
+ } else if (typeof field === 'number' || typeof field === 'boolean') {
content = <p>{field}</p>;
} else if (field instanceof RichTextField) {
content = <p>RTF: {field.Data}</p>;
@@ -153,28 +149,30 @@ class Viewer extends React.Component {
@action
inputOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
this.idToAdd = e.target.value;
- }
+ };
@action
onKeyPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
- if (e.key === "Enter") {
- DocServer.GetRefField(this.idToAdd).then(action((field: any) => {
- if (field !== undefined) {
- this.fields.push(field);
- }
- }));
- this.idToAdd = "";
+ if (e.key === 'Enter') {
+ DocServer.GetRefField(this.idToAdd).then(
+ action((field: any) => {
+ if (field !== undefined) {
+ this.fields.push(field);
+ }
+ })
+ );
+ this.idToAdd = '';
}
- }
+ };
render() {
return (
<>
- <input value={this.idToAdd}
- onChange={this.inputOnChange}
- onKeyDown={this.onKeyPress} />
+ <input value={this.idToAdd} onChange={this.inputOnChange} onKeyDown={this.onKeyPress} />
<div>
- {this.fields.map((field, index) => <DebugViewer field={field} key={index} setValue={() => false}></DebugViewer>)}
+ {this.fields.map((field, index) => (
+ <DebugViewer field={field} key={index} setValue={() => false}></DebugViewer>
+ ))}
</div>
</>
);
@@ -182,11 +180,11 @@ class Viewer extends React.Component {
}
(async function () {
- await DocServer.init(window.location.protocol, window.location.hostname, resolvedPorts.socket, "viewer");
- ReactDOM.render((
- <div style={{ position: "absolute", width: "100%", height: "100%" }}>
+ await DocServer.init(window.location.protocol, window.location.hostname, resolvedPorts.socket, 'viewer');
+ ReactDOM.render(
+ <div style={{ position: 'absolute', width: '100%', height: '100%' }}>
<Viewer />
- </div>),
+ </div>,
document.getElementById('root')
);
-})(); \ No newline at end of file
+})();