Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片上传建议 #913

Open
zsping1989 opened this issue Apr 8, 2021 · 4 comments
Open

图片上传建议 #913

zsping1989 opened this issue Apr 8, 2021 · 4 comments

Comments

@zsping1989
Copy link

建议图片上传功能修改成ajax方式进行上传,跨域上传使用jsonp方式,from表单中添加headers认证参数等信息post很不好处理

@lifa1225
Copy link

同求

@laraveladmin-cn
Copy link

laraveladmin-cn commented May 27, 2021

同求
这个问题我已解决代码参考:
https://gitee.com/laravel-admin/laraveladmin/blob/master/resources/js/components/editorMd.vue
喜欢可以帮忙点个赞

@panchaoco
Copy link

同求

instance.toolbarHandlers.image = () => {
        Modal.info({
          width: 550,
          title: '上传图片',
          content: UploadForm,
          getContainer:
            (document.querySelector('.react-markdown-cmp') as HTMLDivElement) ||
            document.body,
          onOk: () => {
            console.log('inpiu', instance.getCursor());
            console.log('instance.insertValue', instance.insertValue);
            if (inputRef.current?.input.value) {
              // eslint-disable-next-line react/no-this-in-sfc
              instance.insertValue(`![](${inputRef.current?.input.value})`);
            }
          },
        });
        return false;
      };

instance是调用editormd后返回的实例

@panchaoco
Copy link

同求
这个问题我已解决代码参考:
https://gitee.com/laravel-admin/laraveladmin/blob/master/resources/js/components/editorMd.vue
喜欢可以帮忙点个赞

有点太复杂啦,可可看看我的方案,没多少行代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants