mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
30 lines
741 B
TypeScript
30 lines
741 B
TypeScript
import zod from 'zod';
|
|
|
|
import { t } from '../../core/index.js';
|
|
import { propertyType } from '../../core/property/property-config.js';
|
|
export const textPropertyType = propertyType('text');
|
|
|
|
export const textPropertyModelConfig = textPropertyType.modelConfig({
|
|
name: 'Plain-Text',
|
|
propertyData: {
|
|
schema: zod.object({}),
|
|
default: () => ({}),
|
|
},
|
|
jsonValue: {
|
|
schema: zod.string(),
|
|
type: () => t.string.instance(),
|
|
isEmpty: ({ value }) => !value,
|
|
},
|
|
rawValue: {
|
|
schema: zod.string(),
|
|
default: () => '',
|
|
toString: ({ value }) => value,
|
|
fromString: ({ value }) => {
|
|
return { value: value };
|
|
},
|
|
toJson: ({ value }) => value,
|
|
fromJson: ({ value }) => value,
|
|
},
|
|
hide: true,
|
|
});
|