弹出窗口中的Tinymce插入/编辑图像字段在vuetify对话框中不可编辑(聚焦)

问题描述 投票:2回答:1

我知道在bootstrap模式中启用setymce弹出时需要调整所需的调整。但目前我正在使用vuetify对话框。这似乎并没有把重点放在tinymce的弹出领域。 The focus is in the pop behind the tinymce dialog

我已经完成了这个问题,但它不能在vazxswpoi的背景下起作用

下面是我的代码我已经删除了一些方法只是为了清理并保留了我在mount事件和编辑器init中尝试过的基本内容。

TinyMCE 4 links plugin modal in not editable
javascript vue.js vuetify.js tinymce-4
1个回答
3
投票

修改v-dialog的z-index:

当前:

  <no-ssr placeholder="Loading Editor..">
    <tinymce
      id="content"
      :toolbar2="toolbar2"
      :toolbar1="type=='BASIC'?'':toolbar1"
      :plugins="plugins"
      :other_options="other_options"
      v-model="content"
      @input="handleInput"
      v-on:editorInit="initCallBack"
    />
  </no-ssr>
</template>

<script>
//https://dyonir.github.io/vue-tinymce-editor/?en_US
export default {
  props: {
    value: { type: String },
    type: { type: String }
  },
  data() {
    return {
      content: this.value,
      plugins: this.getPlugins(),
      toolbar2: "",
      toolbar1: this.getToolbar1(),
      other_options: {
        menubar: this.getMenubar(),
        height: "320",
        file_browser_callback: this.browseFile,
        auto_focus: '#content'
      }
    };
  },
  mounted(event) {
    // window.tinyMCE.activeEditor.focus();
    // window.tinymce.editors["content"]
    console.log(this.$el, event);
    let list=document.getElementsByClassName("mce-textbox");
    for (let index = 0; index < list.length; ++index) {
    list[index].setAttribute("tabindex", "-1");
}
    //     if ((event.target).closest(".mce-window").length) {
    //     e.stopImmediatePropagation();
    // }
    // this.$refs.refToElement ..$el.focus())
    // this.el.addEventListener('focusin', e => e.stopPropagation());
  },
  methods: {
    handleInput(e) {
      this.$emit("input", this.content);
    },
    initCallBack(e) {
      window.tinymce.editors["content"].setContent(this.value);
      window.tinymce.editors["content"].getBody().focus();
// console.log(this.$refs);
//       const focusable = this.$refs.content.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')
//         focusable.length && focusable[0].focus()

      document.getElementById("content").addEventListener("onfocusin", console.log("fucssed"));
      // tinymce.activeEditor.fire("focus");

this.$el.querySelector(".mce-tinymce").addEventListener('focusin', e =>{ e.stopImmediatePropagation();console.log('event',e)});

      const element = this.$el.querySelector(".mce-tinymce");
      let _this=this;
      if (element)
        this.$nextTick(() => {
          element.focus();
          console.log("FOCUSED",element,_this);
          // element.stopImmediatePropagation();
        });
      // window.tinyMCE.activeEditor.focus();

      //   console.log(this.$el,e);
      //     if ((e).closest(".mce-window").length) {
      //     e.stopImmediatePropagation();
      // }
    }
};
</script>```


I am using the component : https://github.com/dyonir/vue-tinymce-editor
But fields of the pop are not getting focussed/edited.

改性:

z-index: 202

不要忘记!重要的是要优先考虑风格。

© www.soinside.com 2019 - 2024. All rights reserved.