har*_*are 5 javascript wysiwyg editorjs
我将editorjs配置到我的应用程序中。我在上面安装了图像插件,以便我可以将图像上传到服务器。现在我的服务器上传图像并返回指定格式的 JSON,即
\n\n{\n "success": 1,\n "file": {\n "url": "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg",\n // ... and any additional fields you want to store, such as width, height, color, extension, etc\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n响应有 file->url 但上传消息仍然出错
\n\n
这是我的配置代码:
\n\nconst editor = new EditorJS({\n /**\n * Id of Element that should contain Editor instance\n */\n holder: \'heditor\',\n\n /** \n * Available Tools list. \n * Pass Tool\'s class or Settings object for each Tool you want to use \n */\n tools: {\n header: {\n class: Header,\n inlineToolbar: [\'link\'],\n config: {\n placeholder: \'Title...\'\n }\n },\n paragraph: {\n class: Paragraph,\n inlineToolbar: true,\n },\n image: {\n class: ImageTool,\n config: {\n endpoints: {\n accept: \'image/*\',\n byFile: $(\'#heditor\').data(\'url\'), // Your backend file uploader endpoint\n byUrl: $(\'#heditor\').data(\'url\'), // Your endpoint that provides uploading by Url\n },\n additionalRequestHeaders: {\n \'x-auth-token\': $(\'#heditor\').data(\'token\'),\n }\n }\n },\n linkTool: {\n class: LinkTool,\n config: {\n endpoint: \'http://localhost:8008/fetchUrl\', // Your backend endpoint for url data fetching\n }\n },\n inlineCode: {\n class: InlineCode,\n shortcut: \'CMD+SHIFT+M\',\n },\n Marker: {\n class: Marker,\n shortcut: \'CMD+SHIFT+M\',\n },\n embed: Embed,\n\n list: {\n class: List,\n inlineToolbar: true\n }\n },\n\n /**\n * This Tool will be used as default\n */\n // initialBlock: \'paragraph\',\n\n /**\n * Initial Editor data\n */\n data: {\n blocks: [\n {\n type: "header",\n data: {\n text: "Title of your story",\n level: 2\n }\n },\n {\n type: \'paragraph\',\n data: {\n text: \'Hey. Meet the new Story Editor. On this page you can start writing your story \xc3\xa2\xe2\x82\xac\xe2\x80\x9d try to edit this text...\'\n }\n }\n ]\n },\n onReady: function () {\n saveButton.click();\n },\n onChange: function () {\n console.log(\'something changed\');\n }\n});\n\n/**\n * Saving example\n */\nsaveButton.addEventListener(\'click\', function () {\n editor.save().then((savedData) => {\n $("#output").html(savedData);\n });\n});\nRun Code Online (Sandbox Code Playgroud)\n\n我做错了什么有人可以帮忙吗?
\n