Add namespacing to editor.js.
This commit is contained in:
parent
d7b9020585
commit
63a3ecfa88
4 changed files with 8 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
||||||
var PARAGRAPH_TYPES = new Set(["P", "PRE"]);
|
var editor = {};
|
||||||
|
|
||||||
|
editor.PARAGRAPH_TYPES = new Set(["P", "PRE"]);
|
||||||
|
|
||||||
|
editor.Editor =
|
||||||
function Editor(elements, on_open, on_save, on_cancel)
|
function Editor(elements, on_open, on_save, on_cancel)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -115,7 +118,7 @@ function Editor(elements, on_open, on_save, on_cancel)
|
||||||
{
|
{
|
||||||
var display_element = elements[index];
|
var display_element = elements[index];
|
||||||
var edit_element;
|
var edit_element;
|
||||||
if (PARAGRAPH_TYPES.has(display_element.tagName))
|
if (editor.PARAGRAPH_TYPES.has(display_element.tagName))
|
||||||
{
|
{
|
||||||
edit_element = document.createElement("textarea");
|
edit_element = document.createElement("textarea");
|
||||||
edit_element.rows = 6;
|
edit_element.rows = 6;
|
||||||
|
|
|
@ -215,6 +215,6 @@ function on_cancel(editor, edit_element_map, display_element_map)
|
||||||
|
|
||||||
var title_text = document.getElementById("title_text");
|
var title_text = document.getElementById("title_text");
|
||||||
var description_text = document.getElementById("description_text");
|
var description_text = document.getElementById("description_text");
|
||||||
var editor = new Editor([title_text, description_text], on_open, on_save, on_cancel);
|
var editor = new editor.Editor([title_text, description_text], on_open, on_save, on_cancel);
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -144,7 +144,7 @@ function create_editors()
|
||||||
var card = cards[index];
|
var card = cards[index];
|
||||||
var title_div = card.getElementsByClassName("bookmark_title")[0];
|
var title_div = card.getElementsByClassName("bookmark_title")[0];
|
||||||
var url_div = card.getElementsByClassName("bookmark_url")[0];
|
var url_div = card.getElementsByClassName("bookmark_url")[0];
|
||||||
editor = new Editor([title_div, url_div], on_open, on_save, on_cancel);
|
editor = new editor.Editor([title_div, url_div], on_open, on_save, on_cancel);
|
||||||
editor.misc_data["bookmark_id"] = card.dataset.bookmarkId;
|
editor.misc_data["bookmark_id"] = card.dataset.bookmarkId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,7 +293,7 @@ function on_cancel(editor, edit_element_map, display_element_map)
|
||||||
|
|
||||||
var name_text = document.getElementById("name_text");
|
var name_text = document.getElementById("name_text");
|
||||||
var description_text = document.getElementById("description_text");
|
var description_text = document.getElementById("description_text");
|
||||||
var editor = new Editor([name_text, description_text], on_open, on_save, on_cancel);
|
var editor = new editor.Editor([name_text, description_text], on_open, on_save, on_cancel);
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue