如何防止通过媒体编辑器编辑子元素,而父元素是可编辑的。例子:
<div class="editable">
This text should be editable<span class="no-editable"> This text should not be editable.</span>
</div>
<script>
var editor = new MediumEditor('.editable');
</script>
如何防止通过媒体编辑器编辑子元素,而父元素是可编辑的。例子:
<div class="editable">
This text should be editable<span class="no-editable"> This text should not be editable.</span>
</div>
<script>
var editor = new MediumEditor('.editable');
</script>
你只需要将它包裹在一个非 contenteditable 属性上。
<script src="https://yabwe.github.io/medium-editor/bower_components/medium-editor/dist/js/medium-editor.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://yabwe.github.io/medium-editor/bower_components/medium-editor/dist/css/medium-editor.min.css" rel="stylesheet"/>
<link href="https://yabwe.github.io/medium-editor/bower_components/medium-editor/dist/css/themes/tim.min.css" rel="stylesheet"/>
<div class="editable">
<p>
This text should be editable
</p>
<p contenteditable="false">
This text should not be editable.
</p>
</div>
<script>
var editor = new MediumEditor('.editable');
</script>