aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-09-10 13:53:35 -0400
committerbobzel <zzzman@gmail.com>2021-09-10 13:53:35 -0400
commit42d98f5c0a35e173e5eb4651a9a48567a209550f (patch)
treee50a1b8b9d3d01af7a38ed4b6d91c4a7bead79bd /src
parent4d3960bfff57d6e0840f4d09d5a5150a055ac788 (diff)
made web page menu UI functional. made ink show up in minmimap.
Diffstat (limited to 'src')
-rw-r--r--src/client/util/CurrentUserUtils.ts4
-rw-r--r--src/client/views/EditableView.scss1
-rw-r--r--src/client/views/EditableView.tsx4
-rw-r--r--src/client/views/collections/TabDocView.tsx2
-rw-r--r--src/client/views/nodes/button/FontIconBox.tsx30
5 files changed, 28 insertions, 13 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index d58917704..d71537e75 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -1026,8 +1026,8 @@ export class CurrentUserUtils {
[
{ title: "Back", toolTip: "Go back", btnType: ButtonType.ClickButton, icon: "arrow-left", click: 'webBack()' },
{ title: "Forward", toolTip: "Go forward", btnType: ButtonType.ClickButton, icon: "arrow-right", click: 'webForward()' },
- { title: "Reload", toolTip: "Reload webpage", btnType: ButtonType.ClickButton, icon: "redo-alt", click: 'webReload()' },
- { title: "URL", toolTip: "URL", width: 150, btnType: ButtonType.EditableText, icon: "lock", ignoreClick: true, script: 'webSetURL' },
+ //{ title: "Reload", toolTip: "Reload webpage", btnType: ButtonType.ClickButton, icon: "redo-alt", click: 'webReload()' },
+ { title: "URL", toolTip: "URL", width: 250, btnType: ButtonType.EditableText, icon: "lock", ignoreClick: true, script: 'webSetURL' },
];
return tools;
diff --git a/src/client/views/EditableView.scss b/src/client/views/EditableView.scss
index 1aebedf2e..ed7ec9dc1 100644
--- a/src/client/views/EditableView.scss
+++ b/src/client/views/EditableView.scss
@@ -5,6 +5,7 @@
hyphens: auto;
overflow: hidden;
min-width: 20;
+ text-overflow: ellipsis;
}
.editableView-container-editing-oneLine {
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 83336c180..ebf5ca82d 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -155,7 +155,7 @@ export class EditableView extends React.Component<EditableProps> {
return wasFocused !== this._editing;
}
-
+
renderEditor() {
console.log("render editor", this.props.autosuggestProps);
@@ -200,7 +200,7 @@ export class EditableView extends React.Component<EditableProps> {
setTimeout(() => this.props.autosuggestProps?.resetValue());
return this.props.contents instanceof ObjectField ? (null) :
<div className={`editableView-container-editing${this.props.oneLine ? "-oneLine" : ""}`} ref={this._ref}
- style={{ display: this.props.display, textOverflow: this.props.overflow, minHeight: "17px", whiteSpace: "nowrap", height: this.props.height || "auto", maxHeight: this.props.maxHeight }}
+ style={{ display: this.props.display, textOverflow: this.props.overflow, minHeight: "10px", whiteSpace: "nowrap", height: this.props.height || "auto", maxHeight: this.props.maxHeight }}
onClick={this.onClick} placeholder={this.props.placeholder}>
<span style={{ fontStyle: this.props.fontStyle, fontSize: this.props.fontSize }} >
{this.props.contents ? this.props.contents?.valueOf() : this.props.placeholder?.valueOf()}
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index 34cb6ec55..f63e5f844 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -439,7 +439,7 @@ export class TabMinimapView extends React.Component<TabMinimapViewProps> {
case StyleProp.DocContents:
const background = doc.type === DocumentType.PDF ? "red" : doc.type === DocumentType.IMG ? "blue" : doc.type === DocumentType.RTF ? "orange" :
doc.type === DocumentType.VID ? "purple" : doc.type === DocumentType.WEB ? "yellow" : "gray";
- return doc.type === DocumentType.COL ?
+ return doc.type === DocumentType.COL || doc.type === DocumentType.INK ?
undefined :
<div style={{ width: doc[WidthSym](), height: doc[HeightSym](), position: "absolute", display: "block", background }} />;
}
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx
index df7c54f67..fefaadc17 100644
--- a/src/client/views/nodes/button/FontIconBox.tsx
+++ b/src/client/views/nodes/button/FontIconBox.tsx
@@ -32,6 +32,7 @@ import { IButtonProps } from './ButtonInterface';
import { FontIconBadge } from './FontIconBadge';
import './FontIconBox.scss';
import { undo } from 'prosemirror-history';
+import { WebBox } from '../WebBox';
const FontIconSchema = createSchema({
icon: "string",
});
@@ -468,8 +469,9 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon
return (
<div className="menuButton editableText">
<FontAwesomeIcon className={`fontIconBox-icon-${this.type}`} icon={"lock"} />
- <EditableView GetValue={() => checkResult} SetValue={setValue} contents="...">
- </EditableView>
+ <div style={{ width: "calc(100% - .875em)", paddingLeft: "4px" }}>
+ <EditableView GetValue={() => checkResult} SetValue={setValue} contents={checkResult} />
+ </div>
</div>
);
}
@@ -869,13 +871,25 @@ Scripting.addGlobal(function setStrokeColor(color?: string, checkResult?: boolea
* webSetURL
**/
Scripting.addGlobal(function webSetURL(url: string, checkResult?: boolean) {
- const selected = SelectionManager.Docs().lastElement();
- console.log("URL: ", url);
- if (checkResult && selected && selected.type === DocumentType.WEB) {
- return Cast(selected.data, WebField, null).url;
+ const selected = SelectionManager.Views().lastElement();
+ if (selected?.rootDoc.type === DocumentType.WEB) {
+ if (checkResult) {
+ return StrCast(selected.rootDoc.data, Cast(selected.rootDoc.data, WebField, null)?.url?.href);
+ }
+ (selected.ComponentView as WebBox).submitURL(url);
+ //selected.rootDoc.data = new WebField(url);
}
- else if (selected && selected.type === DocumentType.WEB) {
- selected.data = url;
+});
+Scripting.addGlobal(function webForward() {
+ const selected = SelectionManager.Views().lastElement();
+ if (selected?.rootDoc.type === DocumentType.WEB) {
+ (selected.ComponentView as WebBox).forward();
+ }
+});
+Scripting.addGlobal(function webBack() {
+ const selected = SelectionManager.Views().lastElement();
+ if (selected?.rootDoc.type === DocumentType.WEB) {
+ (selected.ComponentView as WebBox).back();
}
});