Commit 4a01ef56 authored by Vivek's avatar Vivek

added bootstrap3-wysiwyg files

parent 9e34de6e
......@@ -105,40 +105,32 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
\n
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta http-equiv="X-UA-Compatible" content="IE=Edge">\n
<meta charset="utf-8">\n
\n
<title>bootstrap-wysihtml5</title>\n
\n
<head>\n
<meta http-equiv="X-UA-Compatible" content="IE=Edge">\n
<meta charset="utf-8">\n
\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="bootstrap3-wysihtml5.min.css"></link>\n
<title>bootstrap-wysihtml5</title>\n
\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"></link>\n
<link rel="stylesheet" type="text/css" href="bootstrap3-wysihtml5.min.css"></link>\n
\n
</head>\n
<body>\n
<div class="container" style=" width: 100%; height: 600px;">\n
<div class="jumbotron" style="margin-left:0px; height: 600px;">\n
<textarea class="textarea" placeholder="Enter text ..." style="width: 100%; height: 400px; font-size: 14px; line-height: 18px;"></textarea>\n
</div>\n
</div>\n
<link rel="http://www.renderjs.org/rel/interface" href="editor_interface.html">\n
\n
<script src="wysihtml5x-toolbar.min.js"></script>\n
<script src="jquery.js"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="handlebars.runtime.min.js"></script>\n
<script src="bootstrap3-wysihtml5.min.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap3-wysiwyg.js" type="text/javascript"></script>\n
\n
<script src="wysihtml5x-toolbar.min.js"></script>\n
<script src="jquery.js"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="handlebars.runtime.min.js"></script>\n
<script src="bootstrap3-wysihtml5.min.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap3-wysiwyg.js"></script>\n
</body>\n
</head>\n
<body></body>\n
</html>\n
......@@ -277,7 +269,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56196.65369.51899</string> </value>
<value> <string>945.2018.8243.11827</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -295,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>1438777350.44</float>
<float>1439468941.87</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -110,19 +110,21 @@
<html lang="en">\n
<head>\n
<meta charset="utf-8">\n
<title>title</title>\n
<title>bootstrap-wysiwhg</title>\n
\n
<link rel="stylesheet" href="bootstrap-combined.no-icons.min.css">\n
<link rel="stylesheet" href="bootstrap-responsive.css">\n
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css">\n
\n
<script src="jquery.js"></script>\n
<script src="jquery.hotkeys.js"></script>\n
<link rel="http://www.renderjs.org/rel/interface" href="editor_interface.html">\n
\n
<script src="jquery.js" type="text/javascript"></script>\n
<script src="jquery.hotkeys.js" type="text/javascript"></script>\n
<script src="bootstrap.min.js"></script>\n
<script src="bootstrap-wysiwyg.js"></script>\n
<script src="rsvp.js"></script>\n
<script src="renderjs.js"></script>\n
<script src="gadget_bootstrap_wysiwyg.js"></script>\n
<script src="gadget_bootstrap_wysiwyg.js" type="text/javascript"></script>\n
\n
</head>\n
<body>\n
......@@ -333,7 +335,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53506.33548.17937</string> </value>
<value> <string>945.2156.1335.48469</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -351,7 +353,7 @@
</tuple>
<state>
<tuple>
<float>1438615893.56</float>
<float>1439467063.04</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -99,7 +99,9 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*jslint indent: 2 */\n
<value> <string encoding="cdata"><![CDATA[
/*jslint indent: 2 */\n
/*global window, jQuery, rJS*/\n
"use strict";\n
\n
......@@ -115,16 +117,26 @@
.declareMethod(\'clearContent\', function () {\n
rJS(this).editor.html(\'\');\n
})\n
.ready(function (g) {\n
g.editor = $(\'.textarea\');\n
g.editor.wysihtml5({\n
.declareMethod(\'setEditor\', function () {\n
document.body.innerHTML =\'<div class="container" style=" width: 100%; height: 600px;">\'\n
+\'<div class="jumbotron" style="margin-left:0px; height: 600px;">\'\n
+\'<textarea class="textarea" placeholder="Enter text ..." \'\n
+\'style="width: 100%; height: 400px; font-size: 14px; line-height: 18px;">\'\n
+\'</textarea></div</div>\';\n
this.editor = $(\'.textarea\');\n
this.editor.wysihtml5({\n
toolbar: {\n
fa: true\n
}\n
});\n
})\n
\n
.ready(function (g) {\n
});\n
\n
}(window, jQuery, rJS));</string> </value>
}(window, jQuery, rJS));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -259,7 +271,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56186.56926.29952</string> </value>
<value> <string>945.1997.11510.44544</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -277,7 +289,7 @@
</tuple>
<state>
<tuple>
<float>1438777746.45</float>
<float>1439471143.4</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -157,12 +157,14 @@
.declareMethod(\'clearContent\', function () {\n
rJS(this).editor.html(\'\');\n
})\n
.ready(function (g) {\n
g.editor = $(\'#editor\');\n
.declareMethod(\'setEditor\', function () {\n
initToolbarBootstrapBindings();\n
g.editor.wysiwyg({\n
this.editor.wysiwyg({\n
fileUploadError: showErrorAlert\n
});\n
})\n
.ready(function (g) {\n
g.editor = $(\'#editor\');\n
});\n
\n
}(window, jQuery, rJS));
......@@ -302,7 +304,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.53151.60155.61457</string> </value>
<value> <string>944.63600.63717.14984</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -320,7 +322,7 @@
</tuple>
<state>
<tuple>
<float>1438594704.78</float>
<float>1439467049.96</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -112,7 +112,21 @@
<body>\n
<h1>Editor Interface</h1>\n
<h3>An interface defining the methods for text editor.</h3>\n
<dl>\n
<dt>getContent</dt>\n
<dd>to fetch the contect from the text editor</dd>\n
<dl></dl>\n
<dt>setContent</dt>\n
<dd>to set the contect to the text editor</dd>\n
<dl>\n
<dt data-parameter-required="required" data-parameter-type="string">content</dt>\n
<dd>the content to be set in the text editor</dd>\n
</dl>\n
</dd>\n
<dt>clearContent</dt>\n
<dd>to clear the contect of the text editor</dd>\n
<dl></dl>\n
</dl>\n
</body>\n
</html>
......@@ -251,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.48991.52289.15735</string> </value>
<value> <string>944.53144.2367.52957</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -269,7 +283,7 @@
</tuple>
<state>
<tuple>
<float>1438345024.7</float>
<float>1439192630.9</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -105,7 +105,6 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
\n
<!DOCTYPE html>\n
<html>\n
<head>\n
......@@ -121,6 +120,7 @@
<script type="text/javascript" src="jquery.js"></script>\n
<script type="text/javascript" src="rsvp.js"></script>\n
<script type="text/javascript" src="renderjs.js"></script>\n
<script src="gadget_global.js" ></script>\n
<script type="text/javascript" src="jquerymobile.js"></script>\n
<script type="text/javascript" src="i18next.js"></script>\n
\n
......@@ -129,27 +129,36 @@
\n
</head>\n
<body>\n
<div data-role="page" id="document">\n
<div data-role="page" class="ui-content gadget-content">\n
<div class="ui-grid-a ui-responsive">\n
<div class="ui-block-a" style="width:60%">\n
<div class="ui-content"></div>\n
</div>\n
<div class="ui-block-b" style="width:30%">\n
<form class="gadget-select-form">\n
<form class="main-gadget-select-form">\n
<div data-role="fieldcontain">\n
<label for="gadget_selector" class="select"></label>\n
<select name="gadget_selector">\n
<option value="https://softinst60317.host.vifib.net/erp5/web_site_module/editor_demo/bootstrap-wysiwyg.html">Text Editor 1</option>\n
<option value="https://softinst60317.host.vifib.net/erp5/web_site_module/editor_demo/bootstrap3-wysiwyg.html">Text Editor 2</option>\n
<label for="main_gadget_selector" >Main Gadget</label>\n
<select name="main_gadget_selector" class="select">\n
<option value="./bootstrap3-wysiwyg.html">Text Editor 2</option>\n
<option value="./interface_test_correct_implemented_gadget.html">Dummy Gadget 1</option>\n
<option value="./interface_test_multiple_interface_correct_gadget.html">Dummy Gadget 2</option>\n
</select>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
<form class="similar-gadget-select-form">\n
<div data-role="fieldcontain">\n
<label for="similar_gadget_selector" >Similar Gadgets</label>\n
<select name="similar_gadget_selector" class="select">\n
</select>\n
</div>\n
<input data-inline="true" type="submit" value="Submit" data-theme="b">\n
</form>\n
</div>\n
</div>\n
</div> \n
</div>\n
</body>\n
</html>\n
\n
]]></string> </value>
......@@ -287,7 +296,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56298.5921.30532</string> </value>
<value> <string>945.2226.34067.16605</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -305,7 +314,7 @@
</tuple>
<state>
<tuple>
<float>1438783361.36</float>
<float>1439471929.19</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -99,13 +99,133 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*jslint indent: 2, maxlen: 80, nomen: true */\n
<value> <string encoding="cdata"><![CDATA[
/*jslint indent: 2, maxlen: 80, nomen: true */\n
/*global console, window, document, rJS, RSVP, $ */\n
(function (window, document, rJS) {\n
(function (window, document, rJS, promiseEventListener) {\n
"use strict";\n
\n
var EDITOR_GADGET_1 = "./bootstrap-wysiwyg.html";\n
var EDITOR_GADGET_2 = "./bootstrap3-wysiwyg.html";\n
var DEFAULT_GADGET_URL = "./bootstrap3-wysiwyg.html",\n
INTERFACE_GADGET_URL = "./gadget_interfaces.html";\n
\n
function declareInterfaceGadget(gadget) {\n
return gadget.declareGadget(INTERFACE_GADGET_URL, {\n
element: gadget.__element,\n
scope: "interface"\n
});\n
}\n
function declareSubGadget(gadget, sub_gadget_url) {\n
return gadget.declareGadget(sub_gadget_url, {\n
sandbox: \'iframe\',\n
element: gadget.props.content_element.querySelector("div.ui-content"),\n
scope: "sub_gadget"\n
});\n
}\n
function getAvailableSubGadgetList(gadget) {\n
var main_gadget = gadget.props.content_element.querySelector(\'form.main-gadget-select-form\'),\n
gadget_option_list = main_gadget.main_gadget_selector.querySelectorAll(\'option\'),\n
gadget_list = [],\n
i;\n
for(i = 0; i < gadget_option_list.length; i += 1) {\n
gadget_list.push({\n
url: gadget_option_list[i].value,\n
display_name: gadget_option_list[i].innerText\n
});\n
}\n
return gadget_list;\n
}\n
function filterSimilarSubGadgetList(gadget, sub_gadget_url) {\n
var interface_gadget,\n
available_subgadget_list;\n
return RSVP.Queue()\n
.push(function() {\n
return gadget.getDeclaredGadget("interface");\n
})\n
.push(function(i_gadget) {\n
interface_gadget = i_gadget;\n
return interface_gadget.getVerifyGadget(sub_gadget_url);\n
})\n
.push(function(sub_gadget) {\n
return RSVP.all([\n
interface_gadget.getDeclaredGadgetInterfaceList(sub_gadget),\n
getAvailableSubGadgetList(gadget)\n
]);\n
})\n
.push(function(result_data) {\n
var interface_url_list = result_data[0],\n
item,\n
status_list = [];\n
available_subgadget_list = result_data[1];\n
for(item in available_subgadget_list) {\n
status_list.push(interface_gadget.verifyGadgetInterfaceListImplementation(available_subgadget_list[item].url, interface_url_list));\n
}\n
return RSVP.all(status_list);\n
})\n
.push(function(result_list) {\n
return [available_subgadget_list, result_list];\n
});\n
}\n
function updateSimilarGadgetOptionList(gadget, sub_gadget_url) {\n
return RSVP.Queue()\n
.push(function() {\n
return filterSimilarSubGadgetList(gadget, sub_gadget_url);\n
})\n
.push(function(filtered_list) {\n
var select = gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\').similar_gadget_selector;\n
select.innerHTML = "";\n
var i;\n
for(i = 0; i < filtered_list[1].length; i += 1) {\n
if(filtered_list[1][i]) {\n
var option = document.createElement("option");\n
option.text = filtered_list[0][i].display_name;\n
option.value = filtered_list[0][i].url;\n
select.appendChild(option);\n
}\n
}\n
return;\n
});\n
}\n
function gadgetSwitchHandler(gadget) {\n
return new RSVP.Queue()\n
.push(function() {\n
return RSVP.any([\n
promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.main-gadget-select-form\'),\n
\'submit\',\n
false\n
),\n
promiseEventListener(\n
gadget.props.content_element.querySelector(\'form.similar-gadget-select-form\'),\n
\'submit\',\n
false\n
)\n
]);\n
})\n
.push(function(submit_event) {\n
var submit_source = submit_event.target.className;\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = true;\n
gadget.props.content_element.querySelector("div.ui-content").innerHTML = "";\n
if(submit_source === \'main-gadget-select-form\') {\n
return RSVP.all([\n
declareSubGadget(gadget,submit_event.target[0].value),\n
updateSimilarGadgetOptionList(gadget, submit_event.target[0].value)\n
]);\n
} else {\n
return declareSubGadget(gadget,submit_event.target[0].value);\n
}\n
})\n
.push(function() {\n
return gadget.editor_setEditor();\n
})\n
.push(function(){\n
gadget.props.content_element.querySelector("input[type=submit]")\n
.disabled = false;\n
return gadgetSwitchHandler(gadget);\n
});\n
}\n
\n
// block JQM auto-start\n
$(document)\n
.on("mobileinit", function () {\n
......@@ -115,57 +235,61 @@
rJS(window)\n
\n
.ready(function (g) {\n
console.log("test gadget ready");\n
g.props = {};\n
return g.getElement()\n
.push(function (element) {\n
$(element).trigger("create");\n
g.props.element = element;\n
g.props.content_element = element.querySelector(\'.gadget-content\');\n
});\n
})\n
\n
.declareMethod(\'render\', function () {\n
var gadget, page_list, page;\n
\n
gadget = this;\n
page_list = document.body.querySelectorAll("[data-role=page]");\n
page = page_list[page_list.length - 1];\n
\n
// helper: declare edtior\n
function declareEditorGadget(editor_g) {\n
return gadget.declareGadget(editor_g, {\n
sandbox: \'iframe\',\n
element: page.querySelector("div.ui-content"),\n
scope: "editor"\n
});\n
}\n
\n
var gadget = this;\n
return new RSVP.Queue()\n
.push(function() {\n
console.log("first gadget");\n
return declareEditorGadget(EDITOR_GADGET_1);\n
return declareInterfaceGadget(gadget, DEFAULT_GADGET_URL);\n
})\n
.push(function() {\n
return declareSubGadget(gadget, DEFAULT_GADGET_URL);\n
})\n
.push(function() {\n
return gadget.editor_setEditor();\n
})\n
.push(function(){\n
page.querySelector("div.ui-content").innerHTML = "";\n
return declareEditorGadget(EDITOR_GADGET_2);\n
return gadgetSwitchHandler(gadget);\n
});\n
\n
})\n
\n
/* ============================ EDITOR =============================== */\n
.declareMethod("editor_getContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.getContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_setContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.setContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_clearContent", function (param_list) {\n
return this.getDeclaredGadget("editor")\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.clearContent.apply(editor, param_list);\n
});\n
})\n
.declareMethod("editor_setEditor", function (param_list) {\n
return this.getDeclaredGadget("sub_gadget")\n
.then(function (editor) {\n
return editor.setEditor.apply(editor, param_list);\n
});\n
});\n
\n
}(window, document, rJS));</string> </value>
}(window, document, rJS, promiseEventListener));
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -300,7 +424,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>944.56235.17061.26624</string> </value>
<value> <string>945.2225.65299.39441</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -318,7 +442,7 @@
</tuple>
<state>
<tuple>
<float>1438780043.78</float>
<float>1439471855.78</float>
<string>GMT</string>
</tuple>
</state>
......
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
web_page_module/editor*
web_page_module/interface_gadget_interfaces*
web_page_module/interface_test_correct_implemented_gadget*
web_page_module/interface_test_multiple_interface_correct_gadget*
web_site_module/editor_demo
web_site_module/editor_demo/**
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment