package kitchen sink demo and include it in the build
This commit is contained in:
parent
930c995c64
commit
63785dc92f
5 changed files with 122 additions and 8 deletions
5
Makefile
5
Makefile
|
|
@ -1,6 +1,11 @@
|
||||||
build:
|
build:
|
||||||
mkdir -p build/src
|
mkdir -p build/src
|
||||||
|
mkdir -p build/demo
|
||||||
mkdir -p build/textarea/src
|
mkdir -p build/textarea/src
|
||||||
|
|
||||||
|
cp demo/styles.css build/demo/styles.css
|
||||||
|
cp demo/logo.png build/demo/logo.png
|
||||||
|
|
||||||
./Makefile.dryice.js normal
|
./Makefile.dryice.js normal
|
||||||
./Makefile.dryice.js bm
|
./Makefile.dryice.js bm
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,9 @@ console.log('# ace ---------');
|
||||||
|
|
||||||
var aceProject = [
|
var aceProject = [
|
||||||
aceHome + '/support/pilot/lib',
|
aceHome + '/support/pilot/lib',
|
||||||
aceHome + '/lib'
|
aceHome + '/support/cockpit/lib',
|
||||||
|
aceHome + '/lib',
|
||||||
|
aceHome
|
||||||
];
|
];
|
||||||
|
|
||||||
if (target == "normal") {
|
if (target == "normal") {
|
||||||
|
|
@ -90,6 +92,8 @@ if (target == "normal") {
|
||||||
source: "build_support/editor.html",
|
source: "build_support/editor.html",
|
||||||
dest: targetDir + '/editor.html'
|
dest: targetDir + '/editor.html'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
demo();
|
||||||
} else if(target == "bm") {
|
} else if(target == "bm") {
|
||||||
copy({
|
copy({
|
||||||
source: "build_support/editor_textarea.html",
|
source: "build_support/editor_textarea.html",
|
||||||
|
|
@ -309,7 +313,6 @@ project.assumeAllFilesLoaded();
|
||||||
console.log('# cockpit ---------');
|
console.log('# cockpit ---------');
|
||||||
|
|
||||||
project.assumeAllFilesLoaded();
|
project.assumeAllFilesLoaded();
|
||||||
project.addRoot(aceHome + '/support/cockpit/lib');
|
|
||||||
|
|
||||||
var cockpit = copy.createDataObject();
|
var cockpit = copy.createDataObject();
|
||||||
copy({
|
copy({
|
||||||
|
|
@ -351,3 +354,66 @@ copy({
|
||||||
source: cockpit,
|
source: cockpit,
|
||||||
dest: 'build/src/cockpit-uncompressed.js'
|
dest: 'build/src/cockpit-uncompressed.js'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function demo() {
|
||||||
|
console.log('# kitchen sink ---------');
|
||||||
|
|
||||||
|
copy({
|
||||||
|
source: "index.html",
|
||||||
|
dest: "build/kitchen-sink.html",
|
||||||
|
filter: [ function(data) {
|
||||||
|
return (data
|
||||||
|
.replace("DEVEL-->", "")
|
||||||
|
.replace("<!--DEVEL", "")
|
||||||
|
.replace("PACKAGE-->", "")
|
||||||
|
.replace("<!--PACKAGE", ""));
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
var project = copy.createCommonJsProject(aceProject);
|
||||||
|
var demo = copy.createDataObject();
|
||||||
|
copy({
|
||||||
|
source: [
|
||||||
|
'build_support/mini_require.js'
|
||||||
|
],
|
||||||
|
dest: demo
|
||||||
|
});
|
||||||
|
copy({
|
||||||
|
source: [
|
||||||
|
copy.source.commonjs({
|
||||||
|
project: project,
|
||||||
|
require: [ "cockpit/index", "pilot/index", "ace/defaults", "demo/boot" ]
|
||||||
|
})
|
||||||
|
],
|
||||||
|
filter: [ copy.filter.moduleDefines ],
|
||||||
|
dest: demo
|
||||||
|
});
|
||||||
|
copy({
|
||||||
|
source: {
|
||||||
|
root: project,
|
||||||
|
include: /.*\.css$/,
|
||||||
|
exclude: /tests?\//
|
||||||
|
},
|
||||||
|
filter: [ copy.filter.addDefines ],
|
||||||
|
dest: demo
|
||||||
|
});
|
||||||
|
copy({
|
||||||
|
source: {
|
||||||
|
root: aceHome + '/support/cockpit/lib',
|
||||||
|
include: /.*\.css$|.*\.html$/,
|
||||||
|
exclude: /tests?\//
|
||||||
|
},
|
||||||
|
filter: [ copy.filter.addDefines ],
|
||||||
|
dest: demo
|
||||||
|
});
|
||||||
|
|
||||||
|
copy({
|
||||||
|
source: demo,
|
||||||
|
filter: copy.filter.uglifyjs,
|
||||||
|
dest: 'build/demo/kitchen-sink.js'
|
||||||
|
});
|
||||||
|
copy({
|
||||||
|
source: demo,
|
||||||
|
dest: 'build/demo/kitchen-sink-uncompressed.js'
|
||||||
|
});
|
||||||
|
}
|
||||||
30
demo/demo.js
30
demo/demo.js
|
|
@ -351,7 +351,14 @@ exports.launch = function(env) {
|
||||||
});
|
});
|
||||||
|
|
||||||
bindDropdown("theme", function(value) {
|
bindDropdown("theme", function(value) {
|
||||||
env.editor.setTheme(value);
|
if (require.packaged) {
|
||||||
|
loadTheme(value, function() {
|
||||||
|
env.editor.setTheme(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
env.editor.setTheme(value);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bindDropdown("keybinding", function(value) {
|
bindDropdown("keybinding", function(value) {
|
||||||
|
|
@ -702,4 +709,25 @@ exports.launch = function(env) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var themes = {};
|
||||||
|
function loadTheme(name, callback) {
|
||||||
|
if (themes[name])
|
||||||
|
return;
|
||||||
|
|
||||||
|
themes[name] = 1;
|
||||||
|
var base = name.split("/").pop();
|
||||||
|
var fileName = "src/theme-" + base + ".js";
|
||||||
|
loadScriptFile(fileName, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadScriptFile(path, callback) {
|
||||||
|
var head = document.getElementsByTagName('head')[0];
|
||||||
|
var s = document.createElement('script');
|
||||||
|
|
||||||
|
s.src = path;
|
||||||
|
head.appendChild(s);
|
||||||
|
|
||||||
|
s.onload = callback;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
12
index.html
12
index.html
|
|
@ -4,7 +4,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Editor</title>
|
<title>Ace Kitchen Sink</title>
|
||||||
<meta name="author" content="Fabian Jakobs">
|
<meta name="author" content="Fabian Jakobs">
|
||||||
<link rel="stylesheet" href="demo/styles.css" type="text/css" media="screen" charset="utf-8">
|
<link rel="stylesheet" href="demo/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||||
</head>
|
</head>
|
||||||
|
|
@ -685,6 +685,7 @@ object implicits extends Application {
|
||||||
}</script>
|
}</script>
|
||||||
<input id="cockpitInput" type="text"/>
|
<input id="cockpitInput" type="text"/>
|
||||||
|
|
||||||
|
<!-- DEVEL-->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var require = {
|
var require = {
|
||||||
paths: {
|
paths: {
|
||||||
|
|
@ -696,5 +697,14 @@ object implicits extends Application {
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<script src="demo/require.js" data-main="demo/boot" type="text/javascript" charset="utf-8"></script>
|
<script src="demo/require.js" data-main="demo/boot" type="text/javascript" charset="utf-8"></script>
|
||||||
|
<!--DEVEL -->
|
||||||
|
|
||||||
|
<!--PACKAGE
|
||||||
|
<script src="demo/kitchen-sink.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
require("demo/boot");
|
||||||
|
</script>
|
||||||
|
PACKAGE-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -114,14 +114,19 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
||||||
|
|
||||||
var scripts = document.getElementsByTagName("script");
|
var scripts = document.getElementsByTagName("script");
|
||||||
for (var i=0; i<scripts.length; i++) {
|
for (var i=0; i<scripts.length; i++) {
|
||||||
var src = scripts[i].src || scripts[i].getAttribute("src");
|
var script = scripts[i];
|
||||||
|
|
||||||
|
var base = script.getAttribute("data-ace-base");
|
||||||
|
if (base)
|
||||||
|
return base.replace(/\/*$/, "/");
|
||||||
|
|
||||||
|
var src = script.src || script.getAttribute("src");
|
||||||
if (!src) {
|
if (!src) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var m = src.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);
|
var m = src.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);
|
||||||
if (m) {
|
if (m)
|
||||||
return m[1] || m[2];
|
return m[1] || m[2];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue