From 929512da59d8678ac37c7ac9d0f6c2c9fa968d50 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Fri, 10 Apr 2020 14:08:22 -0400 Subject: rearranged button/script field keys to -rawscript, - --- src/client/documents/DocumentTypes.ts | 1 + src/client/documents/Documents.ts | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/client/documents') diff --git a/src/client/documents/DocumentTypes.ts b/src/client/documents/DocumentTypes.ts index ab32d7301..de366763b 100644 --- a/src/client/documents/DocumentTypes.ts +++ b/src/client/documents/DocumentTypes.ts @@ -15,6 +15,7 @@ export enum DocumentType { FONTICON = "fonticonbox", // font icon QUERY = "query", // search query LABEL = "label", // simple text label + BUTTON = "button", // onClick button WEBCAM = "webcam", // webcam PDFANNO = "pdfanno", // pdf text selection (could be just a collection?) DATE = "date", // calendar view of a date diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 22f22cbfd..b5c6dc06a 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -116,6 +116,7 @@ export interface DocumentOptions { borderRounding?: string; boxShadow?: string; dontRegisterChildren?: boolean; + "onClick-rawScript"?:string; // onClick script in raw text form _pivotField?: string; // field key used to determine headings for sections in stacking, masonry, pivot views schemaColumns?: List; dockingConfig?: string; @@ -144,7 +145,6 @@ export interface DocumentOptions { treeViewChecked?: ScriptField; // script to call when a tree view checkbox is checked isFacetFilter?: boolean; // whether document functions as a facet filter in a tree view limitHeight?: number; // maximum height for newly created (eg, from pasting) text documents - editScriptOnClick?: string; // script field key to edit when document is clicked (e.g., "onClick", "onChecked") // [key: string]: Opt; pointerHack?: boolean; // for buttons, allows onClick handler to fire onPointerDown textTransform?: string; // is linear view expanded @@ -247,6 +247,9 @@ export namespace Docs { [DocumentType.LABEL, { layout: { view: LabelBox, dataField: data }, }], + [DocumentType.BUTTON, { + layout: { view: LabelBox, dataField: "onClick" }, + }], [DocumentType.SLIDER, { layout: { view: SliderBox, dataField: data }, }], @@ -654,7 +657,7 @@ export namespace Docs { } export function ButtonDocument(options?: DocumentOptions) { - return InstanceFromProto(Prototypes.get(DocumentType.LABEL), undefined, { ...(options || {}), editScriptOnClick: "onClick" }); + return InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" }); } export function SliderDocument(options?: DocumentOptions) { -- cgit v1.2.3-70-g09d2