From d1e4d4a9daae4f037cf8b22e1011d97680a01e27 Mon Sep 17 00:00:00 2001 From: srichman333 Date: Tue, 2 May 2023 17:44:00 -0400 Subject: update properties view, document decorations, and sharing manager show + use correct acl --- src/fields/Doc.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/fields/Doc.ts') diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 4d82551db..5e2e40979 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -135,7 +135,6 @@ export const ReverseHierarchyMap: Map // this recursively updates all protos as well. export function updateCachedAcls(doc: Doc) { if (!doc) return; - const target = (doc as any)?.__fields ?? doc; const permissions: { [key: string]: symbol } = !target.author || target.author === Doc.CurrentUserEmail ? { 'acl-Me': AclAdmin } : {}; Object.keys(target).filter(key => key.startsWith('acl') && (permissions[key] = ReverseHierarchyMap.get(StrCast(target[key]))!.acl)); @@ -1117,7 +1116,7 @@ export namespace Doc { target[targetKey] = new PrefetchProxy(templateDoc); } else { titleTarget && (Doc.GetProto(target).title = titleTarget); - const setDoc = [AclAdmin, AclEdit].includes(GetEffectiveAcl(Doc.GetProto(target))) ? Doc.GetProto(target) : target; + const setDoc = [AclAdmin, AclEdit, AclAugment].includes(GetEffectiveAcl(Doc.GetProto(target))) ? Doc.GetProto(target) : target; setDoc[targetKey] = new PrefetchProxy(templateDoc); } } @@ -1295,7 +1294,9 @@ export namespace Doc { } // don't bother memoizing (caching) the result if called from a non-reactive context. (plus this avoids a warning message) export function IsBrushedDegreeUnmemoized(doc: Doc) { - if (!doc || GetEffectiveAcl(doc) === AclPrivate || GetEffectiveAcl(Doc.GetProto(doc)) === AclPrivate || doc.opacity === 0) return DocBrushStatus.unbrushed; + if (!doc || GetEffectiveAcl(doc) === AclPrivate || GetEffectiveAcl(Doc.GetProto(doc)) === AclPrivate || doc.opacity === 0) { + return DocBrushStatus.unbrushed; + } const status = brushManager.BrushedDoc.has(doc) ? DocBrushStatus.selfBrushed : brushManager.BrushedDoc.has(Doc.GetProto(doc)) ? DocBrushStatus.protoBrushed : DocBrushStatus.unbrushed; if (status === DocBrushStatus.unbrushed) { const lastBrushed = Array.from(brushManager.BrushedDoc.keys()).lastElement(); -- cgit v1.2.3-70-g09d2 From 50876028b994044f2a9426a4efb85a363f0d7168 Mon Sep 17 00:00:00 2001 From: srichman333 Date: Thu, 4 May 2023 10:46:20 -0400 Subject: properties view + sharing manager are consistent, and all text updates properly --- src/client/documents/Documents.ts | 2 +- src/client/util/SharingManager.scss | 5 + src/client/util/SharingManager.tsx | 120 ++++----------------- src/client/views/DocComponent.tsx | 10 +- src/client/views/DocumentDecorations.scss | 3 +- src/client/views/DocumentDecorations.tsx | 6 +- src/client/views/Main.tsx | 2 +- src/client/views/MarqueeAnnotator.tsx | 4 +- src/client/views/PropertiesView.scss | 4 +- src/client/views/PropertiesView.tsx | 93 ++++++---------- .../views/nodes/formattedText/FormattedTextBox.tsx | 9 +- .../formattedText/ProsemirrorExampleTransfer.ts | 12 +-- src/fields/Doc.ts | 3 - src/fields/util.ts | 6 +- 14 files changed, 81 insertions(+), 198 deletions(-) (limited to 'src/fields/Doc.ts') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index f5510d7e1..9c67f1f37 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -506,7 +506,7 @@ export namespace Docs { description: '', showCaption: 'description', backgroundColor: 'lightblue', // lightblue is default color for linking dot and link documents text comment area - _removeDropProperties: new List(['isLinkButton']), + // _removeDropsties: new List(['isLinkButton']), }, }, ], diff --git a/src/client/util/SharingManager.scss b/src/client/util/SharingManager.scss index f47c48805..3cab77816 100644 --- a/src/client/util/SharingManager.scss +++ b/src/client/util/SharingManager.scss @@ -23,6 +23,11 @@ z-index: 999; } + .share-title { + display: inline-flex; + gap: 5px; + } + .share-container { .share-setup { display: flex; diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 5e61f6d3c..40a282db0 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -25,6 +25,7 @@ import { GroupMemberView } from './GroupMemberView'; import { LinkManager } from './LinkManager'; import { SelectionManager } from './SelectionManager'; import './SharingManager.scss'; +import { IconButton, Size } from 'browndash-components'; export interface User { email: string; @@ -159,27 +160,14 @@ export class SharingManager extends React.Component<{}> { const myAcl = `acl-${Doc.CurrentUserEmailNormalized}`; const isDashboard = DocListCast(Doc.MyDashboards.data).indexOf(target) !== -1; - // var docs: Doc[] = []; - // const dashboardList = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document); - // const dashboard = dashboardList[0] - // docs.push(dashboard!) - // const tabs = DocListCast(dashboard?.data) - // tabs.forEach(tab => { - // docs.push(tab) - // var newDocs = DocListCast(tab.data) - // newDocs.forEach(newDoc => - // docs.push(newDoc)) - // }) - - // if (!docs){ - // return null; - // } + // setting the same acl for a docs within the doc being shared + var childDocs = DocListCast(target.data) + childDocs.map(doc => { + this.setInternalSharing(recipient, permission, doc) + }) const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document); - //var docs: Doc[] = []; - docs.push(targetDoc!) - // ! ensures it returns true if document has been shared successfully, false otherwise return !docs .map(doc => (this.layoutDocAcls ? doc : doc[DataSym])) @@ -191,7 +179,6 @@ export class SharingManager extends React.Component<{}> { } else { if (!doc[acl] || doc[acl] === SharingPermissions.None) doc.numUsersShared = NumCast(doc.numUsersShared, 0) + 1; } - doc = targetDoc distributeAcls(acl, permission as SharingPermissions, doc, undefined, undefined, isDashboard); this.setDashboardBackground(doc, permission as SharingPermissions); @@ -211,19 +198,15 @@ export class SharingManager extends React.Component<{}> { const key = normalizeEmail(StrCast(group.title)); const acl = `acl-${key}`; const isDashboard = DocListCast(Doc.MyDashboards.data).indexOf(target) !== -1; - - var docs: Doc[] = []; - const dashboardList = SelectionManager.Views().length < 2 ? [this.targetDoc] : SelectionManager.Views().map(docView => docView.props.Document); - const dashboard = dashboardList[0] - const tabs = DocListCast(dashboard?.data) - tabs.forEach(tab => { - var newDocs = DocListCast(tab.data) - newDocs.forEach(newDoc => docs.push(newDoc)) - }) - if (!docs){ - return null; - } + // setting the same acl for a docs within the doc being shared + var childDocs = DocListCast(target.data) + childDocs.map(doc => { + this.setInternalGroupSharing(group, permission, doc) + }) + + const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document); + // ! ensures it returns true if document has been shared successfully, false otherwise return !docs .map(doc => (this.layoutDocAcls ? doc : doc[DataSym])) @@ -292,6 +275,7 @@ export class SharingManager extends React.Component<{}> { const dashboards = DocListCast(Doc.MyDashboards.data); docs.forEach(doc => { const isDashboard = dashboards.indexOf(doc) !== -1; + this.shareFromPropertiesSidebar(shareWith, permission, DocListCast(doc.data)) if (GetEffectiveAcl(doc) === AclAdmin) distributeAcls(`acl-${shareWith}`, permission, doc, undefined, undefined, isDashboard); this.setDashboardBackground(doc, permission as SharingPermissions); }); @@ -364,30 +348,15 @@ export class SharingManager extends React.Component<{}> { // return; // } // targetDoc["acl-" + PublicKey] = permission; - // } - - private get sharingUrl() { - if (!this.targetDoc) { - return undefined; - } - const baseUrl = Utils.prepend("/doc/" + this.targetDoc[Id]); - return `${baseUrl}?sharing=true`; - } + // }s /** * Copies the Public sharing url to the user's clipboard. */ private copyURL = (e: any) => { - Utils.CopyText(this.sharingUrl!) + Utils.CopyText(Utils.shareUrl(this.targetDoc![Id])) } - // copy = action(() => { - // if (this.sharingUrl) { - // Utils.CopyText(this.sharingUrl); - // this.copied = true; - // } - // }); - /** * Returns the SharingPermissions (Admin, Can Edit etc) access that's used to share */ @@ -396,7 +365,6 @@ export class SharingManager extends React.Component<{}> { if (!uniform) dropdownValues.unshift('-multiple-'); if (!override) dropdownValues.splice(dropdownValues.indexOf(SharingPermissions.Unset), 1); return dropdownValues - .filter(permission => permission != SharingPermissions.SelfEdit && (!Doc.noviceMode || ![SharingPermissions.SelfEdit].includes(permission as any))) .map(permission => (