mirror of
https://github.com/codex-team/editor.js
synced 2024-05-18 22:36:47 +02:00
export editor content to result textarea by click on "save" button
save button must have a special ID "codex_editor_export_btn" closes #5 and closes old tasks #11 #9 #3 #12 #7
This commit is contained in:
parent
54d51f42d2
commit
ba12890a61
|
@ -42,7 +42,6 @@ var ce = function(settings) {
|
|||
/** Bind all events */
|
||||
this.bindEvents();
|
||||
|
||||
|
||||
};
|
||||
|
||||
// All posible tools
|
||||
|
@ -88,7 +87,7 @@ ce.prototype.makeInterface = function () {
|
|||
|
||||
/** Insert Editor after initial textarea. Hide textarea */
|
||||
this.resultTextarea.parentNode.insertBefore(wrapper, this.resultTextarea.nextSibling);
|
||||
//this.resultTextarea.hidden = true;
|
||||
this.resultTextarea.hidden = true;
|
||||
|
||||
this.focusNode(firstNode);
|
||||
};
|
||||
|
@ -99,7 +98,8 @@ ce.prototype.makeInterface = function () {
|
|||
* пока по кнопке "экспорт", потом можно сделать на каждое изменение в редакторе (надо ли это?)
|
||||
* */
|
||||
ce.prototype.exportHtml = function () {
|
||||
this.resultTextarea.value = this.editableWrapper.innerHTML;
|
||||
this.resultTextarea.innerHTML = this.editableWrapper.innerHTML;
|
||||
this.resultTextarea.value = this.editableWrapper.innerHTML;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
@ -178,10 +178,10 @@ ce.prototype.bindEvents = function () {
|
|||
selectedNodeClass = "selected";
|
||||
|
||||
/*
|
||||
* Экспорт разметки в итоговый textarea
|
||||
* пока по кнопке "экспорт", потом можно сделать на каждое изменение в редакторе (надо ли это?)
|
||||
* Экспорт разметки в итоговый textarea по нажатию на кнопку "сохранить".
|
||||
* Кнопка сохранения должна иметь, так же как и textarea, особенный ID.
|
||||
* */
|
||||
document.getElementById("export_html").addEventListener('click', function () {
|
||||
document.getElementById("codex_editor_export_btn").addEventListener('click', function () {
|
||||
_this.exportHtml.apply(_this)
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<h1>CodeX Editor</h1>
|
||||
|
||||
<button id="export_html">Экспорт</button>
|
||||
<button id="codex_editor_export_btn">Сохранить</button>
|
||||
<br>
|
||||
<br>
|
||||
<form action="">
|
||||
|
|
Loading…
Reference in a new issue