javascript - 在 quill-image-resize-vue 中对齐时出错

标签 javascript html css vue.js vuejs2

当我使用“quill-image-resize-vue”时,图像对齐有问题,对齐到中心或右边,但是当我去查看结果时,它是左对齐的。

并非在所有情况下都会发生,但我无法确定它在哪些情况下会失败。

我唯一注意到的是,当它工作时,img 属性有“display: block”和“margin: auto”。

这是我的代码:

import { VueEditor } from "vue2-editor";
import { ImageDrop } from "quill-image-drop-module";
import ImageResize from "quill-image-resize-vue";

export default {
  name: "format-document-form",
  components: {
    VueEditor,
  },
  data: function () {
      editorData: "<p>Desarrollo de la agenda...</p>",
      customModulesForEditor: [
        { alias: "imageDrop", module: ImageDrop },
        { alias: "imageResize", module: ImageResize },
      ],
      editorSettings: {
        modules: {
          imageDrop: true,
          imageResize: {},
        },
      },
   }
}

HTML:

<vue-editor
  v-model="editorData"
  :customModules="customModulesForEditor"
  :editorOptions="editorSettings"
></vue-editor>

当我创建它时,它看起来像这样: form

但是当我解释 HTML 时,它看起来像这样: result html

最佳答案

我最近将 quill-image-resize-vue 添加到我的 vue2 编辑器中,发现编辑器中的以下一组步骤可以保持对齐:

  1. 点击您需要的对齐方式。
  2. 调整图片大小。
  3. 保存 html 数据。

仅调整图像大小效果很好,但图像对齐作为一个独立的操作似乎不起作用。

Vue 编辑器主工具栏中可用的对齐选项似乎可以正确对齐图像,所以我只使用它们。要在调整图像大小时禁用对齐,我使用了:

editorSettings: {
                modules: {
                  imageResize: {
                    modules: ['Resize', 'DisplaySize']
                  },
                }
              }

关于javascript - 在 quill-image-resize-vue 中对齐时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63589933/

相关文章:

android - 在 Android 浏览器中压缩的背景图像

javascript - 从 <ul> 单独展开/折叠 div 的 jQuery 代码

javascript - QuickSearchJS 与 ajax 调用

javascript - 列表项的删除按钮

php - 使用表格内的按钮通过 jQuery 打开模式

javascript - 使用 jQuery 在特定的@media 查询下异步设置或覆盖 CSS 属性

javascript - Angular Checkbutton 行为错误

javascript - 如何在 Angular js 中的 .run 方法内调用读取 json 文件的工厂?是否可能?

html - 如何更改 webkit-scrollbar-thumb 的长度?

javascript - iOS 是否提供 AirPlay 相关的 HTML5 视频事件?