Browse Source

Make text children not editable

pull/415/head
Artur Arseniev 8 years ago
parent
commit
8f7f80bc72
  1. 1
      src/dom_components/view/ComponentTextView.js
  2. 7
      src/rich_text_editor/index.js
  3. 6
      src/rich_text_editor/model/RichTextEditor.js

1
src/dom_components/view/ComponentTextView.js

@ -65,6 +65,7 @@ module.exports = ComponentView.extend({
} else {
const clean = model => {
model.set({
editable: 0,
highlightable: 0,
removable: 0,
draggable: 0,

7
src/rich_text_editor/index.js

@ -164,6 +164,7 @@ module.exports = () => {
const pfx = this.pfx;
const el = view.getChildrenContainer();
const customRte = this.customRte;
const actionbar = this.actionbar;
const actionbarContainer = toolbar;
const classes = {
actionbar: `${pfx}actionbar`,
@ -172,7 +173,11 @@ module.exports = () => {
toolbar.style.display = '';
rte = customRte ? customRte.enable(el, rte) :
new RichTextEditor({el, actionbarContainer, classes}).enable();
new RichTextEditor({el, actionbarContainer, classes, actionbar}).enable();
if (rte.actionbar) {
this.actionbar = rte.actionbar;
}
if (em) {
setTimeout(this.udpatePosition.bind(this), 0);

6
src/rich_text_editor/model/RichTextEditor.js

@ -25,7 +25,7 @@ const actions = {
result: (rte) => rte.exec('strikeThrough')
},
link: {
icon: '🔗',
icon: 'Link',
title: 'Link',
result: (rte) => {
const url = window.prompt('Enter the link URL')
@ -43,8 +43,8 @@ export default class RichTextEditor {
return el[RTE_KEY];
}
el.oninput = e => settings.onChange && settings.onChange(e.target.innerHTML);
el.onkeydown = e => (e.which === 9 && e.preventDefault());
//el.oninput = e => settings.onChange && settings.onChange(e.target.innerHTML);
//el.onkeydown = e => (e.which === 9 && e.preventDefault());
el[RTE_KEY] = this;
this.el = el;
this.doc = el.ownerDocument;

Loading…
Cancel
Save