mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Fix summernote issues
This commit is contained in:
parent
f7b4934f6b
commit
0e324a349d
|
@ -5856,7 +5856,9 @@ var Editor_Editor = /*#__PURE__*/function () {
|
|||
value: function beforeCommand() {
|
||||
this.context.triggerEvent('before.command', this.$editable.html()); // Set styleWithCSS before run a command
|
||||
|
||||
try {
|
||||
document.execCommand('styleWithCSS', false, this.options.styleWithCSS); // keep focus on editable before command execution
|
||||
} catch (e) {}
|
||||
|
||||
this.focus();
|
||||
}
|
||||
|
|
22
app/index.js
22
app/index.js
|
@ -79,17 +79,9 @@ Router.add('/test', function(render) {
|
|||
// nodepad
|
||||
Router.add('/notepad', function(render) {
|
||||
// load resources
|
||||
Browser.addResources([
|
||||
{
|
||||
type: "javascript",
|
||||
url: "app/assets/mixed/summernote-0.8.18-dist/summernote-lite.js"
|
||||
},
|
||||
{
|
||||
type: "stylesheet",
|
||||
url: "app/assets/mixed/summernote-0.8.18-dist/summernote-lite.css"
|
||||
}
|
||||
]);
|
||||
|
||||
Browser.addStylesheet("app/assets/mixed/summernote-0.8.18-dist/summernote-lite.css");
|
||||
Browser.waitUntil(function(test, ttl) {
|
||||
Browser.addScript("app/assets/mixed/summernote-0.8.18-dist/summernote-lite.js", function(el) {
|
||||
// set DOM id
|
||||
var target_dom_id = "summernote";
|
||||
|
||||
|
@ -102,6 +94,14 @@ Router.add('/notepad', function(render) {
|
|||
$('#' + target_dom_id).summernote({
|
||||
minHeight: 300
|
||||
});
|
||||
|
||||
}, test, ttl);
|
||||
}, function(el) {
|
||||
alert(typeof $.summernote);
|
||||
return $.summernote;
|
||||
});
|
||||
|
||||
document.getElementById("useragent").innerHTML = window.navigator.userAgent;
|
||||
});
|
||||
|
||||
// go
|
||||
|
|
|
@ -8,5 +8,18 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<div class="panel cell">
|
||||
<div class="header">User Agent</div>
|
||||
<div class="body">
|
||||
<div class="cell">
|
||||
<div class="col">
|
||||
<span id="useragent"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -128,7 +128,7 @@ function getIEVersion() {
|
|||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// exports.waitUntil()
|
||||
// waitUntil()
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function waitUntil(f, test, ttl) {
|
||||
if (typeof f !== "function") return;
|
||||
|
@ -177,34 +177,26 @@ function addScript(url, callback, test, ttl) {
|
|||
return el;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// addResources()
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function addResources(resources, callback) {
|
||||
resources.forEach(function(resource) {
|
||||
if (["javascript", "text/javascript"].indexOf(resource.type) > -1) {
|
||||
addScript(resource.url, callback);
|
||||
} else if (["stylesheet", "text/css"].indexOf(resource.type) > -1) {
|
||||
addStylesheet(resource.url, callback);
|
||||
} else {
|
||||
console.warn("Not supported resource type");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// addStylesheet()
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
function addStylesheet(url, callback) {
|
||||
function addStylesheet(url, callback, test, ttl) {
|
||||
if (typeof test !== "function") {
|
||||
test = function(el, callback, ttl) {};
|
||||
}
|
||||
var ttl = (typeof ttl === "number" ? ttl : 30000); // TTL(Time-To-Live)
|
||||
|
||||
var el = document.createElement("link");
|
||||
el.href = url;
|
||||
el.rel = "stylesheet";
|
||||
el.type = "text/css";
|
||||
el.media = "screen, projection";
|
||||
document.head.appendChild(el);
|
||||
if (typeof(callback) === "function") {
|
||||
el.onload = callback(el);
|
||||
|
||||
if (typeof test === "function") {
|
||||
test(el, callback, ttl);
|
||||
}
|
||||
|
||||
return el;
|
||||
};
|
||||
|
||||
|
@ -274,14 +266,13 @@ function close() {
|
|||
exports.getIEVersion = getIEVersion;
|
||||
exports.waitUntil = waitUntil;
|
||||
exports.addScript = addScript;
|
||||
exports.addResources = addResources;
|
||||
exports.addStylesheet = addStylesheet;
|
||||
exports.setContent = setContent;
|
||||
exports.start = start;
|
||||
exports.reload = reload;
|
||||
exports.close = close;
|
||||
|
||||
exports.VERSIONINFO = "Browser Library (browser.js) version 0.1.3";
|
||||
exports.VERSIONINFO = "Browser Library (browser.js) version 0.1.4";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user