mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 03:56:23 +08:00
33 lines
807 B
TypeScript
33 lines
807 B
TypeScript
import zod from 'zod';
|
|
|
|
import { t } from '../../core/logical/type-presets.js';
|
|
import { propertyType } from '../../core/property/property-config.js';
|
|
|
|
export const imagePropertyType = propertyType('image');
|
|
|
|
export const imagePropertyModelConfig = imagePropertyType.modelConfig({
|
|
name: 'image',
|
|
propertyData: {
|
|
schema: zod.object({}),
|
|
default: () => ({}),
|
|
},
|
|
jsonValue: {
|
|
schema: zod.string().nullable(),
|
|
isEmpty: ({ value }) => value == null,
|
|
type: () => t.image.instance(),
|
|
},
|
|
rawValue: {
|
|
schema: zod.string().nullable(),
|
|
default: () => null,
|
|
toString: ({ value }) => value ?? '',
|
|
fromString: ({ value }) => {
|
|
return {
|
|
value: value,
|
|
};
|
|
},
|
|
toJson: ({ value }) => value,
|
|
fromJson: ({ value }) => value,
|
|
},
|
|
hide: true,
|
|
});
|