Front-end/lexical/修改图片组件.lexical

1 line
9.3 KiB
Plaintext
Raw Normal View History

2024-09-21 23:58:12 -04:00
{"editorState":{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"创建插件","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"heading","version":1,"tag":"h1"},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"最简单的插件是一个接受实例并返回清理函数的函数。","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"计划插入组件因此使用DecoratorNode。","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"export","type":"code-highlight","version":1,"highlightType":"keyword"},{"detail":0,"format":0,"mode":"normal","style":"","text":" ","type":"code-highlight","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"class","type":"code-highlight","version":1,"highlightType":"keyword"},{"detail":0,"format":0,"mode":"normal","style":"","text":" ","type":"code-highlight","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"ImageNode","type":"code-highlight","version":1,"highlightType":"class-name"},{"detail":0,"format":0,"mode":"normal","style":"","text":" ","type":"code-highlight","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"extends","type":"code-highlight","version":1,"highlightType":"keyword"},{"detail":0,"format":0,"mode":"normal","style":"","text":" ","type":"code-highlight","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"DecoratorNode","type":"code-highlight","version":1,"highlightType":"class-name"}],"direction":"ltr","format":"","indent":0,"type":"code","version":1,"language":"javascript"},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"必须方法","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"heading","version":1,"tag":"h2"},{"children":[{"children":[{"detail":0,"format":16,"mode":"normal","style":"","text":"constructor(...)","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":" + class props Allows us to store custom data within nodes at runtime as well as accept custom parameters.","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":1},{"children":[{"detail":0,"format":16,"mode":"normal","style":"","text":"getType()","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":" & ","type":"text","version":1},{"detail":0,"format":16,"mode":"normal","style":"","text":"clone(...)","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"  methods allow Lexical to correctly identify node type as well as being able to clone it correctly as we may want to customize cloning behavior.","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":2},{"children":[{"detail":0,"format":16,"mode":"normal","style":"","text":"importJSON(...)","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":" & ","type":"text","version":1},{"detail":0,"format":16,"mode":"normal","style":"","text":"exportJSON()","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"  define how our data will be serialized / deserialized to/from Lexical state. Here you define your node presentation in state.","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":3},{"children":[{"detail":0,"format":16,"mode":"normal","style":"","text":"createDOM(...)","type":"text","version":1},{"detail":0,"format":0,"mode":"normal","style":"","text":"  defines DOM that will be rendered by Lexical","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"listitem","version":1,"value":4}],"direction":"ltr","format":"","indent":0,"type":"list","version":1,"l