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

富文本发布时,上传图片相对路径不正确 #62

Open
hn4930 opened this issue Mar 21, 2023 · 2 comments
Open

富文本发布时,上传图片相对路径不正确 #62

hn4930 opened this issue Mar 21, 2023 · 2 comments

Comments

@hn4930
Copy link

hn4930 commented Mar 21, 2023

富文本中上传图片后为
<img data-mce-src="public/xxx/xxx.jpg">
这个相对路径在127.0.0.1:7001/admin下可以工作
但是在前台页面如 http://127.0.0.1:7001/cms/detail/1 中是错误的

目前暂时将app/controller/cms/doc.js:getContent:266中的type为input-rich-text的obj.options中增加了tinymce的配置项切换到绝对路径修复

          obj.type = 'input-rich-text';
          obj.receiver = {
            method: 'post',
            url: '/upload/adminToken',
            headers: {
              resBody: '{"link":"{{url}}"}',
            },
          };
          obj.options = {
            height: 600,
            relative_urls: false,
            remove_script_host: false,
            convert_urls: true,
            document_base_url: '/',
            codesample_languages: [
              { text: 'HTML', value: 'html' },
              { text: 'JavaScript', value: 'javascript' },
              { text: 'CSS', value: 'css' },
              { text: 'json', value: 'json' },
              { text: 'graphql', value: 'graphql' },
              { text: 'bash', value: 'bash' },
              { text: 'git', value: 'git' },
              { text: 'markdown', value: 'markdown' },
              { text: 'sql', value: 'sql' },
              { text: 'typescript', value: 'typescript' },
            ],
            content_css: '/public/sys/prism.css',
          };
@569258yin
Copy link

我也遇到了相同的问题,感谢你的代码,❤️

@zl810881283
Copy link
Collaborator

zl810881283 commented Jun 20, 2024 via email

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

3 participants