diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-08-07 10:52:01 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-08-07 10:52:01 -0500 |
commit | 5c3e84b8dc22ee630e4612f594635b56b5a7ee9a (patch) | |
tree | 6ae1069356f86e60107415147607d3fb423a40b1 /src | |
parent | ea3a2d51e130b1ea5954d9bb13658d25d8eac975 (diff) |
reverting back
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/CurrentUserUtils.ts | 55 |
1 files changed, 4 insertions, 51 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index b1c98e549..fdca2b0da 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -385,7 +385,7 @@ export class CurrentUserUtils { return doc["template-icons"] as Doc; } - static creatorBtnDescriptors(doc: Doc, novice: boolean): { + static creatorBtnDescriptors(doc: Doc): { title: string, toolTip: string, icon: string, drag?: string, ignoreClick?: boolean, click?: string, ischecked?: string, activeInkPen?: Doc, backgroundColor?: string, dragFactory?: Doc, hidden?: any, }[] { @@ -504,11 +504,7 @@ export class CurrentUserUtils { }; // novice : [collection, web, compare, audio, button, pres] - if (novice) { - return [collection, web, compare, audio, button, pres]; - } else { - return [collection, web, compare, screen, audio, button, pres, search, script, preview, repl]; - } + return [collection, web, compare, screen, audio, button, pres, search, script, preview, repl]; } @@ -523,7 +519,7 @@ export class CurrentUserUtils { alreadyCreatedButtons = dragDocs.map(d => StrCast(d.title)); } } - const buttons = CurrentUserUtils.creatorBtnDescriptors(doc, true).filter(d => !alreadyCreatedButtons?.includes(d.title)); + const buttons = CurrentUserUtils.creatorBtnDescriptors(doc).filter(d => !alreadyCreatedButtons?.includes(d.title)); const creatorBtns = buttons.map(({ title, toolTip, icon, ignoreClick, drag, click, ischecked, activeInkPen, backgroundColor, dragFactory }) => Docs.Create.FontIconDocument({ _nativeWidth: 50, _nativeHeight: 50, _width: 50, _height: 50, @@ -555,48 +551,6 @@ export class CurrentUserUtils { return doc.myItemCreators as Doc; } - static async setupDevCreatorButtons(doc: Doc) { - let alreadyCreatedButtons: string[] = []; - const dragCreatorSet = await Cast(doc.myItemCreators, Doc, null); - if (dragCreatorSet) { - const dragCreators = await Cast(dragCreatorSet.data, listSpec(Doc)); - if (dragCreators) { - const dragDocs = await Promise.all(dragCreators); - alreadyCreatedButtons = dragDocs.map(d => StrCast(d.title)); - } - } - const buttons = CurrentUserUtils.creatorBtnDescriptors(doc, false).filter(d => !alreadyCreatedButtons?.includes(d.title)); - const creatorBtns = buttons.map(({ title, toolTip, icon, ignoreClick, drag, - click, ischecked, activeInkPen, backgroundColor, dragFactory }) => Docs.Create.FontIconDocument({ - _nativeWidth: 50, _nativeHeight: 50, _width: 50, _height: 50, - icon, - title, - toolTip, - ignoreClick, - dropAction: "copy", - onDragStart: drag ? ScriptField.MakeFunction(drag) : undefined, - onClick: click ? ScriptField.MakeScript(click) : undefined, - ischecked: ischecked ? ComputedField.MakeFunction(ischecked) : undefined, - activeInkPen, - backgroundColor, - removeDropProperties: new List<string>(["dropAction"]), - dragFactory, - })); - - if (dragCreatorSet === undefined) { - doc.myItemCreators = new PrefetchProxy(Docs.Create.MasonryDocument(creatorBtns, { - title: "Basic Item Creators", - hidden: ComputedField.MakeFunction("self.target.noviceMode") as any, - _showTitle: "title", _xMargin: 0, - _autoHeight: true, _width: 500, _columnWidth: 35, ignoreClick: true, lockedPosition: true, _chromeStatus: "disabled", - dropConverter: ScriptField.MakeScript("convertToButtons(dragData)", { dragData: DragManager.DocumentDragData.name }), - })); - } else { - creatorBtns.forEach(nb => Doc.AddDocToList(doc.myItemCreators as Doc, "data", nb)); - } - return doc.myItemCreators as Doc; - } - static menuBtnDescriptions(): { title: string, icon: string, click: string, }[] { @@ -764,13 +718,12 @@ export class CurrentUserUtils { static async setupToolsBtnPanel(doc: Doc) { // setup a masonry view of all he creators const creatorBtns = await CurrentUserUtils.setupCreatorButtons(doc); - const devBtns = await CurrentUserUtils.setupDevCreatorButtons(doc); const templateBtns = CurrentUserUtils.setupUserTemplateButtons(doc); doc["tabs-button-tools"] = undefined; if (doc.myCreators === undefined) { - doc.myCreators = new PrefetchProxy(Docs.Create.StackingDocument([creatorBtns, devBtns, templateBtns], { + doc.myCreators = new PrefetchProxy(Docs.Create.StackingDocument([creatorBtns, templateBtns], { title: "all Creators", _yMargin: 0, _autoHeight: true, _xMargin: 0, _width: 500, ignoreClick: true, lockedPosition: true, _chromeStatus: "disabled", })); |