自动摘要
正在生成中……
在 jQuery-File-Upload 示例代码中看到一个用于处理跨域问题的html, 代码是这样的
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery Iframe Transport Plugin Redirect Page</title>
</head>
<body>
<script>
document.body.innerText = document.body.textContent = decodeURIComponent(
window.location.search.slice(1)
);
</script>
</body>
</html>
windows.location.search
指的是查询页面url的查询参数部分,比如 https://www.google.com/?s=hello&hl=zh-cn
这条网址windows.location.search
指的是 "?s=hello&hl=zh-cn
" ,然后使用 .slice(1)
截取从第二个字符开始到结束的字符, 得到不带问号的查询字符串 s=hello&hl=zh-cn
slice()
方法提取某个字符串的一部分,并返回一个新的字符串,且不会改动原字符串。ref: MDN
const str = 'The quick brown fox jumps over the lazy dog.';
console.log(str.slice(31));
// expected output: "the lazy dog."
console.log(str.slice(4, 19));
// expected output: "quick brown fox"
console.log(str.slice(-4));
// expected output: "dog."
console.log(str.slice(-9, -5));
// expected output: "lazy"
slice 不仅可以在字符串上使用,也支持数组的裁切 ,还有其他类型
其实我不是在写博客,主要想试试代码高亮和上传图片。打开文件管理器的快捷方式是Ctrl+E
,加 inline code
也要考虑增加一个快捷键,就用Ctrl+C
吧。上图……
我去,responsive filemanager
引用太多国外的js,突然间都挂了,赶紧换个线路终于连上了,看来之后很有必要下载回来放自己网站,哦,不能忘记上图:

PS: 一番摸索,终于查找到增加切换code元素包裹文字的快捷键方法,代码是这样的:
tinymce.init({
selector: "#hi-editor",
language: "zh_CN",
toolbar_sticky: true,
menubar: false,
setup: function(editor) {
function toggleCode() { //定义切换的函数
editor.execCommand('mceToggleFormat', false, 'code'); //格式化
}
editor.ui.registry.addButton("codeSC", {
text:"<i class='fa fa-file-code-o w3-large w3-text-grey'></i>", //工具栏的按钮图标
tooltip: "insert code Element Here",
shortcut: 'Ctrl+C', //快捷键
onAction: toggleCode //切换的函数
});
editor.addShortcut('Ctrl+C', '', toggleCode ); //切换的函数,这里也要添加不然无法唤出
....