aboutsummaryrefslogtreecommitdiff
path: root/src/fields/util.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-30 11:16:37 -0400
committerbobzel <zzzman@gmail.com>2025-03-30 11:16:37 -0400
commit63772da2b6f07365023d10c5df93c1e8c4f0b6b6 (patch)
tree0a6b07cd2da36b11ad2501d90b8682307553ef93 /src/fields/util.ts
parent163b0d9d54d9477792e1b7cdc64bbcb5d2897b4f (diff)
changed Doc.Layout calls to doc[DocLayout]. fixed flashcard ui placement on card view. fixed css scaling for styleprovider icons and annotation resizer
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r--src/fields/util.ts25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts
index abbe543e8..205c500a5 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -303,30 +303,23 @@ export function SetPropSetterCb(prop: string, propSetter: ((target: Doc, value:
//
// target should be either a Doc or ListImpl. receiver should be a Proxy<Doc> Or List.
//
-export function setter(target: ListImpl<FieldType> | Doc, inProp: string | symbol | number, value: unknown, receiver: Doc | ListImpl<FieldType>): boolean {
- if (!inProp) {
+export function setter(target: ListImpl<FieldType> | Doc, prop: string | symbol | number, value: unknown, receiver: Doc | ListImpl<FieldType>): boolean {
+ if (!prop) {
console.log('WARNING: trying to set an empty property. This should be fixed. ');
return false;
}
- let prop = inProp;
- const effectiveAcl = inProp === 'constructor' || typeof inProp === 'symbol' ? AclAdmin : GetPropAcl(target, prop);
+ const effectiveAcl = prop === 'constructor' || typeof prop === 'symbol' ? AclAdmin : GetPropAcl(target, prop);
if (effectiveAcl !== AclEdit && effectiveAcl !== AclAugment && effectiveAcl !== AclAdmin) return true;
// if you're trying to change an acl but don't have Admin access / you're trying to change it to something that isn't an acceptable acl, you can't
if (typeof prop === 'string' && prop.startsWith('acl_') && (effectiveAcl !== AclAdmin || ![...Object.values(SharingPermissions), undefined].includes(value as SharingPermissions))) return true;
- if (typeof prop === 'string' && prop !== '__id' && prop !== '__fieldTuples' && prop.startsWith('$')) {
- prop = prop.substring(1);
- if (target.__DATA__ instanceof Doc) {
- target.__DATA__[prop] = value as FieldResult;
- return true;
- }
+ if (target instanceof Doc && typeof prop === 'string' && prop !== '__id' && prop !== '__fieldTuples' && prop.startsWith('$')) {
+ target.__DATA__[prop.substring(1)] = value as FieldResult;
+ return true;
}
- if (typeof prop === 'string' && prop !== '__id' && prop !== '__fieldTuples' && prop.startsWith('_')) {
- if (!prop.startsWith('__')) prop = prop.substring(1);
- if (target.__LAYOUT__ instanceof Doc) {
- target.__LAYOUT__[prop] = value as FieldResult;
- return true;
- }
+ if (target instanceof Doc && typeof prop === 'string' && prop !== '__id' && prop !== '__fieldTuples' && prop.startsWith('_') && !prop.startsWith('__')) {
+ target.__LAYOUT__[prop.substring(1)] = value as FieldResult;
+ return true;
}
if (target.__fieldTuples[prop] instanceof ComputedField) {
if (target.__fieldTuples[prop].setterscript && value !== undefined && !(value instanceof ComputedField)) {