From 42d98f5c0a35e173e5eb4651a9a48567a209550f Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 10 Sep 2021 13:53:35 -0400 Subject: made web page menu UI functional. made ink show up in minmimap. --- src/client/views/nodes/button/FontIconBox.tsx | 30 ++++++++++++++++++++------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/client/views/nodes/button') 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(Fon return (
- checkResult} SetValue={setValue} contents="..."> - +
+ checkResult} SetValue={setValue} contents={checkResult} /> +
); } @@ -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(); } }); -- cgit v1.2.3-70-g09d2