begin of thinksaas 3.68

Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
2023-06-22 13:33:25 +08:00
commit 963ec1b2ea
2746 changed files with 331806 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
<?php
+5
View File
@@ -0,0 +1,5 @@
$(document).ready(function() {
$('#tseditor').summernote({
height:300
});
});
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,273 @@
/*!
*
* Super simple wysiwyg editor v0.8.18
* https://summernote.org
*
*
* Copyright 2013- Alan Hong. and other contributors
* summernote may be freely distributed under the MIT license.
*
* Date: 2020-05-20T18:09Z
*
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 49);
/******/ })
/************************************************************************/
/******/ ({
/***/ 49:
/***/ (function(module, exports) {
(function ($) {
$.extend($.summernote.lang, {
'zh-CN': {
font: {
bold: '粗体',
italic: '斜体',
underline: '下划线',
clear: '清除格式',
height: '行高',
name: '字体',
strikethrough: '删除线',
subscript: '下标',
superscript: '上标',
size: '字号'
},
image: {
image: '图片',
insert: '插入图片',
resizeFull: '缩放至 100%',
resizeHalf: '缩放至 50%',
resizeQuarter: '缩放至 25%',
floatLeft: '靠左浮动',
floatRight: '靠右浮动',
floatNone: '取消浮动',
shapeRounded: '形状: 圆角',
shapeCircle: '形状: 圆',
shapeThumbnail: '形状: 缩略图',
shapeNone: '形状: 无',
dragImageHere: '将图片拖拽至此处',
dropImage: '拖拽图片或文本',
selectFromFiles: '从本地上传',
maximumFileSize: '文件大小最大值',
maximumFileSizeError: '文件大小超出最大值。',
url: '图片地址',
remove: '移除图片',
original: '原始图片'
},
video: {
video: '视频',
videoLink: '视频链接',
insert: '插入视频',
url: '视频地址',
providers: '(优酷, 腾讯, Instagram, DailyMotion, Youtube等)'
},
link: {
link: '链接',
insert: '插入链接',
unlink: '去除链接',
edit: '编辑链接',
textToDisplay: '显示文本',
url: '链接地址',
openInNewWindow: '在新窗口打开'
},
table: {
table: '表格',
addRowAbove: '在上方插入行',
addRowBelow: '在下方插入行',
addColLeft: '在左侧插入列',
addColRight: '在右侧插入列',
delRow: '删除行',
delCol: '删除列',
delTable: '删除表格'
},
hr: {
insert: '水平线'
},
style: {
style: '样式',
p: '普通',
blockquote: '引用',
pre: '代码',
h1: '标题 1',
h2: '标题 2',
h3: '标题 3',
h4: '标题 4',
h5: '标题 5',
h6: '标题 6'
},
lists: {
unordered: '无序列表',
ordered: '有序列表'
},
options: {
help: '帮助',
fullscreen: '全屏',
codeview: '源代码'
},
paragraph: {
paragraph: '段落',
outdent: '减少缩进',
indent: '增加缩进',
left: '左对齐',
center: '居中对齐',
right: '右对齐',
justify: '两端对齐'
},
color: {
recent: '最近使用',
more: '更多',
background: '背景',
foreground: '前景',
transparent: '透明',
setTransparent: '透明',
reset: '重置',
resetToDefault: '默认'
},
shortcut: {
shortcuts: '快捷键',
close: '关闭',
textFormatting: '文本格式',
action: '动作',
paragraphFormatting: '段落格式',
documentStyle: '文档样式',
extraKeys: '额外按键'
},
help: {
insertParagraph: '插入段落',
undo: '撤销',
redo: '重做',
tab: '增加缩进',
untab: '减少缩进',
bold: '粗体',
italic: '斜体',
underline: '下划线',
strikethrough: '删除线',
removeFormat: '清除格式',
justifyLeft: '左对齐',
justifyCenter: '居中对齐',
justifyRight: '右对齐',
justifyFull: '两端对齐',
insertUnorderedList: '无序列表',
insertOrderedList: '有序列表',
outdent: '减少缩进',
indent: '增加缩进',
formatPara: '设置选中内容样式为 普通',
formatH1: '设置选中内容样式为 标题1',
formatH2: '设置选中内容样式为 标题2',
formatH3: '设置选中内容样式为 标题3',
formatH4: '设置选中内容样式为 标题4',
formatH5: '设置选中内容样式为 标题5',
formatH6: '设置选中内容样式为 标题6',
insertHorizontalRule: '插入水平线',
'linkDialog.show': '显示链接对话框'
},
history: {
undo: '撤销',
redo: '重做'
},
specialChar: {
specialChar: '特殊字符',
select: '选取特殊字符'
}
}
});
})(jQuery);
/***/ })
/******/ });
});
+2
View File
@@ -0,0 +1,2 @@
/*! For license information please see summernote-zh-CN.min.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(window,(function(){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=49)}({49:function(e,t){var r;(r=jQuery).extend(r.summernote.lang,{"zh-CN":{font:{bold:"粗体",italic:"斜体",underline:"下划线",clear:"清除格式",height:"行高",name:"字体",strikethrough:"删除线",subscript:"下标",superscript:"上标",size:"字号"},image:{image:"图片",insert:"插入图片",resizeFull:"缩放至 100%",resizeHalf:"缩放至 50%",resizeQuarter:"缩放至 25%",floatLeft:"靠左浮动",floatRight:"靠右浮动",floatNone:"取消浮动",shapeRounded:"形状: 圆角",shapeCircle:"形状: 圆",shapeThumbnail:"形状: 缩略图",shapeNone:"形状: 无",dragImageHere:"将图片拖拽至此处",dropImage:"拖拽图片或文本",selectFromFiles:"从本地上传",maximumFileSize:"文件大小最大值",maximumFileSizeError:"文件大小超出最大值。",url:"图片地址",remove:"移除图片",original:"原始图片"},video:{video:"视频",videoLink:"视频链接",insert:"插入视频",url:"视频地址",providers:"(优酷, 腾讯, Instagram, DailyMotion, Youtube等)"},link:{link:"链接",insert:"插入链接",unlink:"去除链接",edit:"编辑链接",textToDisplay:"显示文本",url:"链接地址",openInNewWindow:"在新窗口打开"},table:{table:"表格",addRowAbove:"在上方插入行",addRowBelow:"在下方插入行",addColLeft:"在左侧插入列",addColRight:"在右侧插入列",delRow:"删除行",delCol:"删除列",delTable:"删除表格"},hr:{insert:"水平线"},style:{style:"样式",p:"普通",blockquote:"引用",pre:"代码",h1:"标题 1",h2:"标题 2",h3:"标题 3",h4:"标题 4",h5:"标题 5",h6:"标题 6"},lists:{unordered:"无序列表",ordered:"有序列表"},options:{help:"帮助",fullscreen:"全屏",codeview:"源代码"},paragraph:{paragraph:"段落",outdent:"减少缩进",indent:"增加缩进",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐"},color:{recent:"最近使用",more:"更多",background:"背景",foreground:"前景",transparent:"透明",setTransparent:"透明",reset:"重置",resetToDefault:"默认"},shortcut:{shortcuts:"快捷键",close:"关闭",textFormatting:"文本格式",action:"动作",paragraphFormatting:"段落格式",documentStyle:"文档样式",extraKeys:"额外按键"},help:{insertParagraph:"插入段落",undo:"撤销",redo:"重做",tab:"增加缩进",untab:"减少缩进",bold:"粗体",italic:"斜体",underline:"下划线",strikethrough:"删除线",removeFormat:"清除格式",justifyLeft:"左对齐",justifyCenter:"居中对齐",justifyRight:"右对齐",justifyFull:"两端对齐",insertUnorderedList:"无序列表",insertOrderedList:"有序列表",outdent:"减少缩进",indent:"增加缩进",formatPara:"设置选中内容样式为 普通",formatH1:"设置选中内容样式为 标题1",formatH2:"设置选中内容样式为 标题2",formatH3:"设置选中内容样式为 标题3",formatH4:"设置选中内容样式为 标题4",formatH5:"设置选中内容样式为 标题5",formatH6:"设置选中内容样式为 标题6",insertHorizontalRule:"插入水平线","linkDialog.show":"显示链接对话框"},history:{undo:"撤销",redo:"重做"},specialChar:{specialChar:"特殊字符",select:"选取特殊字符"}}})}})}));
@@ -0,0 +1 @@
/*! Summernote v0.8.18 | (c) 2013- Alan Hong and other contributors | MIT license */
+92
View File
@@ -0,0 +1,92 @@
document.emojiSource = siteUrl+'plugins/pubs/summernote/plugin/emojis/'; //relative path to emojis
var content = $('textarea[name="content"]')
$(document).ready(function() {
var $summernote = $('#tseditor').summernote({
toolbar: [
['cleaner',['cleaner']],
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
//['fontname', ['fontname']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link','unlink', 'picture','ts_attach','ts_video','ts_audio']],
['highlight', ['highlight']],
['view', ['fullscreen']],
],
cleaner:{
action: 'both', // both|button|paste 'button' only cleans via toolbar button, 'paste' only clean when pasting content, both does both options.
newline: '<br>', // Summernote's default is to use '<p><br></p>'
notStyle: 'position:absolute;top:0;left:0;right:0', // Position of Notification
icon: '<i class="note-icon">[清理HTML]</i>',
keepHtml: true, // Remove all Html formats
keepOnlyTags: ['<p>', '<br>', '<ul>', '<li>', '<b>', '<strong>','<i>', '<a>','<img>'], // If keepHtml is true, remove all tags except these
keepClasses: true, // Remove Classes
badTags: ['style', 'script', 'applet', 'embed', 'noframes', 'noscript', 'html'], // Remove full tags with contents
badAttributes: ['style', 'start'], // Remove attributes from remaining tags
limitChars: false, // 0/false|# 0/false disables option
limitDisplay: 'both', // text|html|both
limitStop: false // true/false
},
placeholder:'开始创作吧...',
height:300,
//处理图片大小
imageCompression: {
enabled: true,
maxSizeMB: 0.5,
maxWidthOrHeight: 800
},
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $editable) {
//console.log('onChange:', contents, $editable);
content.val(contents)
},
onImageUpload: function(files) {
// upload image to server and create imgNode...
// $summernote.summernote('insertNode', imgNode)
//console.log(files[0])
sendFile($summernote, files[0]);
}
}
});
//ajax上传图片
function sendFile($summernote, file) {
var formData = new FormData();
formData.append("photo", file);
$.ajax({
url: siteUrl+"index.php?app=pubs&ac=editor&ts=photo",
data: formData,
type: 'POST',
//如果提交data是FormData类型,那么下面三句一定需要加上
cache: false,
contentType: false,
processData: false,
success: function (data) {
$summernote.summernote('insertImage', data); //直接插入路径就行,filename可选
console.log(data);
},
error:function(){
alert("上传图片失败!");
}
});
}
});
+60
View File
@@ -0,0 +1,60 @@
var content = $('textarea[name="content"]')
$(document).ready(function() {
var $summernote = $('#tseditor').summernote({
toolbar: [
['font', ['bold', 'clear']],
//['para', ['ul', 'ol', 'paragraph']],
['insert', ['picture','ts_attach','ts_video','ts_audio']]
],
placeholder:'开始创作吧...',
height:300,
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $editable) {
//console.log('onChange:', contents, $editable);
content.val(contents)
},
onImageUpload: function(files) {
// upload image to server and create imgNode...
// $summernote.summernote('insertNode', imgNode)
//console.log(files[0])
sendFile($summernote, files[0]);
}
}
});
//ajax上传图片
function sendFile($summernote, file) {
var formData = new FormData();
formData.append("photo", file);
$.ajax({
url: siteUrl+"index.php?app=pubs&ac=editor&ts=photo",
data: formData,
type: 'POST',
//如果提交data是FormData类型,那么下面三句一定需要加上
cache: false,
contentType: false,
processData: false,
success: function (data) {
$summernote.summernote('insertImage', data); //直接插入路径就行,filename可选
console.log(data);
},
error:function(){
alert("上传图片失败!");
}
});
}
});
+52
View File
@@ -0,0 +1,52 @@
document.emojiSource = siteUrl+'plugins/pubs/summernote/plugin/emojis/'; //relative path to emojis
var content = $('textarea[name="content"]')
$(document).ready(function() {
var $summernote = $('#tseditor').summernote({
height:100,
toolbar: [
['Insert', ['link','picture','ts_attach','ts_video','ts_audio']],
['misc', ['emoji']]
],
lang: 'zh-CN',
callbacks: {
onChange: function(contents, $editable) {
content.val(contents)
},
onImageUpload: function(files) {
sendFile($summernote, files[0]);
}
}
});
//ajax上传图片
function sendFile($summernote, file) {
var formData = new FormData();
formData.append("photo", file);
$.ajax({
url: siteUrl+"index.php?app=pubs&ac=editor&ts=photo",
data: formData,
type: 'POST',
//如果提交data是FormData类型,那么下面三句一定需要加上
cache: false,
contentType: false,
processData: false,
success: function (data) {
$summernote.summernote('insertImage', data); //直接插入路径就行,filename可选
console.log(data);
},
error:function(){
alert("上传图片失败!");
}
});
}
});
+9
View File
@@ -0,0 +1,9 @@
/**
* Created by Administrator on 2016/7/12.
*/
$(document).ready(function() {
$('#tseditor').summernote({
height: 100,
toolbar: false
});
});
Binary file not shown.
@@ -0,0 +1,118 @@
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals: jQuery
factory(window.jQuery);
}
}(function ($) {
$.extend($.summernote.plugins, {
'ts_attach': function (context) {
var self = this;
var ui = $.summernote.ui;
var $editor = context.layoutInfo.editor;
var options = context.options;
var lang = options.langInfo;
context.memo('button.ts_attach', function () {
var button = ui.button({
contents: '<i class="fas fa-paperclip"></i>',
tooltip: 'ts_attach',
click: function () {
self.show()
}
});
// create jQuery object from button instance.
var $highlight = button.render();
return $highlight;
});
this.createDialog = function () {
var $box = $('<div />');
var $frame = $('<iframe width="100%" height="444" frameborder="0" scrolling="no" src="'+siteUrl+'index.php?app=attach&ac=editor&ts=list" />');
$box.append($frame);
return $box.html();
};
this.showAttachDialog = function () {
return $.Deferred(function () {
ui.onDialogShown(self.$dialog, function () {
});
ui.onDialogHidden(self.$dialog, function () {
});
ui.showDialog(self.$dialog);
});
};
this.show = function () {
this.showAttachDialog().then(function () {
self.$dialog.modal('hide');
context.invoke('editor.restoreRange');
});
};
this.initialize = function () {
var $container = options.dialogsInBody ? $(document.body) : $editor;
var body = [''].join('');
this.$dialog = ui.dialog({
className: 'ts-attach',
title: '我的附件',
body: this.createDialog(),
footer: body,
//callback: function ($node) {
// $node.find('.modal-body').css({
// 'max-height': 300,
// 'overflow': 'scroll'
// });
//}
}).render().appendTo($container);
};
this.destroy = function () {
ui.hideDialog(this.$dialog);
this.$dialog.remove();
};
}
})
}))
@@ -0,0 +1,118 @@
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals: jQuery
factory(window.jQuery);
}
}(function ($) {
$.extend($.summernote.plugins, {
'ts_audio': function (context) {
var self = this;
var ui = $.summernote.ui;
var $editor = context.layoutInfo.editor;
var options = context.options;
var lang = options.langInfo;
context.memo('button.ts_audio', function () {
var button = ui.button({
contents: '<i class="fas fa-headphones"></i>',
tooltip: 'ts_audio',
click: function () {
self.show()
}
});
// create jQuery object from button instance.
var $highlight = button.render();
return $highlight;
});
this.createDialog = function () {
var $box = $('<div />');
var $frame = $('<iframe width="100%" height="444" frameborder="0" scrolling="no" src="'+siteUrl+'index.php?app=audio&ac=editor&ts=list" />');
$box.append($frame);
return $box.html();
};
this.showAttachDialog = function () {
return $.Deferred(function () {
ui.onDialogShown(self.$dialog, function () {
});
ui.onDialogHidden(self.$dialog, function () {
});
ui.showDialog(self.$dialog);
});
};
this.show = function () {
this.showAttachDialog().then(function () {
self.$dialog.modal('hide');
context.invoke('editor.restoreRange');
});
};
this.initialize = function () {
var $container = options.dialogsInBody ? $(document.body) : $editor;
var body = [''].join('');
this.$dialog = ui.dialog({
className: 'ts-audio',
title: '我的音频',
body: this.createDialog(),
footer: body,
//callback: function ($node) {
// $node.find('.modal-body').css({
// 'max-height': 300,
// 'overflow': 'scroll'
// });
//}
}).render().appendTo($container);
};
this.destroy = function () {
ui.hideDialog(this.$dialog);
this.$dialog.remove();
};
}
})
}))
@@ -0,0 +1,16 @@
.ext-databasic {
position: relative;
display: block;
min-height: 50px;
background-color: cyan;
text-align: center;
padding: 20px;
border: 1px solid white;
border-radius: 10px;
}
.ext-databasic p {
color: white;
font-size: 1.2em;
margin: 0;
}
@@ -0,0 +1,291 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(window.jQuery);
}
}(function($) {
// pull in some summernote core functions
var ui = $.summernote.ui;
var dom = $.summernote.dom;
// define the popover plugin
var DataBasicPlugin = function(context) {
var self = this;
var options = context.options;
var lang = options.langInfo;
self.icon = '<i class="fa fa-object-group"/>';
// add context menu button for dialog
context.memo('button.databasic', function() {
return ui.button({
contents: self.icon,
tooltip: lang.databasic.insert,
click: context.createInvokeHandler('databasic.showDialog'),
}).render();
});
// add popover edit button
context.memo('button.databasicDialog', function() {
return ui.button({
contents: self.icon,
tooltip: lang.databasic.edit,
click: context.createInvokeHandler('databasic.showDialog'),
}).render();
});
// add popover size buttons
context.memo('button.databasicSize100', function() {
return ui.button({
contents: '<span class="note-fontsize-10">100%</span>',
tooltip: lang.image.resizeFull,
click: context.createInvokeHandler('editor.resize', '1'),
}).render();
});
context.memo('button.databasicSize50', function() {
return ui.button({
contents: '<span class="note-fontsize-10">50%</span>',
tooltip: lang.image.resizeHalf,
click: context.createInvokeHandler('editor.resize', '0.5'),
}).render();
});
context.memo('button.databasicSize25', function() {
return ui.button({
contents: '<span class="note-fontsize-10">25%</span>',
tooltip: lang.image.resizeQuarter,
click: context.createInvokeHandler('editor.resize', '0.25'),
}).render();
});
self.events = {
'summernote.init': function(we, e) {
// update existing containers
$('data.ext-databasic', e.editable).each(function() { self.setContent($(this)); });
// TODO: make this an undo snapshot...
},
'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function() {
self.update();
},
'summernote.dialog.shown': function() {
self.hidePopover();
},
};
self.initialize = function() {
// create dialog markup
var $container = options.dialogsInBody ? $(document.body) : context.layoutInfo.editor;
var body = '<div class="form-group row-fluid">' +
'<label>' + lang.databasic.testLabel + '</label>' +
'<input class="ext-databasic-test form-control" type="text" />' +
'</div>';
var footer = '<button href="#" class="btn btn-primary ext-databasic-save">' + lang.databasic.insert + '</button>';
self.$dialog = ui.dialog({
title: lang.databasic.name,
fade: options.dialogsFade,
body: body,
footer: footer,
}).render().appendTo($container);
// create popover
self.$popover = ui.popover({
className: 'ext-databasic-popover',
}).render().appendTo('body');
var $content = self.$popover.find('.popover-content');
context.invoke('buttons.build', $content, options.popover.databasic);
};
self.destroy = function() {
self.$popover.remove();
self.$popover = null;
self.$dialog.remove();
self.$dialog = null;
};
self.update = function() {
// Prevent focusing on editable when invoke('code') is executed
if (!context.invoke('editor.hasFocus')) {
self.hidePopover();
return;
}
var rng = context.invoke('editor.createRange');
var visible = false;
if (rng.isOnData()) {
var $data = $(rng.sc).closest('data.ext-databasic');
if ($data.length) {
var pos = dom.posFromPlaceholder($data[0]);
self.$popover.css({
display: 'block',
left: pos.left,
top: pos.top,
});
// save editor target to let size buttons resize the container
context.invoke('editor.saveTarget', $data[0]);
visible = true;
}
}
// hide if not visible
if (!visible) {
self.hidePopover();
}
};
self.hidePopover = function() {
self.$popover.hide();
};
// define plugin dialog
self.getInfo = function() {
var rng = context.invoke('editor.createRange');
if (rng.isOnData()) {
var $data = $(rng.sc).closest('data.ext-databasic');
if ($data.length) {
// Get the first node on range(for edit).
return {
node: $data,
test: $data.attr('data-test'),
};
}
}
return {};
};
self.setContent = function($node) {
$node.html('<p contenteditable="false">' + self.icon + ' ' + lang.databasic.name + ': ' +
$node.attr('data-test') + '</p>');
};
self.updateNode = function(info) {
self.setContent(info.node
.attr('data-test', info.test));
};
self.createNode = function(info) {
var $node = $('<data class="ext-databasic"></data>');
if ($node) {
// save node to info structure
info.node = $node;
// insert node into editor dom
context.invoke('editor.insertNode', $node[0]);
}
return $node;
};
self.showDialog = function() {
var info = self.getInfo();
var newNode = !info.node;
context.invoke('editor.saveRange');
self
.openDialog(info)
.then(function(dialogInfo) {
// [workaround] hide dialog before restore range for IE range focus
ui.hideDialog(self.$dialog);
context.invoke('editor.restoreRange');
// insert a new node
if (newNode) {
self.createNode(info);
}
// update info with dialog info
$.extend(info, dialogInfo);
self.updateNode(info);
})
.fail(function() {
context.invoke('editor.restoreRange');
});
};
self.openDialog = function(info) {
return $.Deferred(function(deferred) {
var $inpTest = self.$dialog.find('.ext-databasic-test');
var $saveBtn = self.$dialog.find('.ext-databasic-save');
var onKeyup = function(event) {
if (event.keyCode === 13) {
$saveBtn.trigger('click');
}
};
ui.onDialogShown(self.$dialog, function() {
context.triggerEvent('dialog.shown');
$inpTest.val(info.test).on('input', function() {
ui.toggleBtn($saveBtn, $inpTest.val());
}).trigger('focus').on('keyup', onKeyup);
$saveBtn
.text(info.node ? lang.databasic.edit : lang.databasic.insert)
.click(function(event) {
event.preventDefault();
deferred.resolve({ test: $inpTest.val() });
});
// init save button
ui.toggleBtn($saveBtn, $inpTest.val());
});
ui.onDialogHidden(self.$dialog, function() {
$inpTest.off('input keyup');
$saveBtn.off('click');
if (deferred.state() === 'pending') {
deferred.reject();
}
});
ui.showDialog(self.$dialog);
});
};
};
// Extends summernote
$.extend(true, $.summernote, {
plugins: {
databasic: DataBasicPlugin,
},
options: {
popover: {
databasic: [
['databasic', ['databasicDialog', 'databasicSize100', 'databasicSize50', 'databasicSize25']],
],
},
},
// add localization texts
lang: {
'en-US': {
databasic: {
name: 'Basic Data Container',
insert: 'insert basic data container',
edit: 'edit basic data container',
testLabel: 'test input',
},
},
},
});
}));
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

@@ -0,0 +1,311 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals
factory(window.jQuery);
}
}(function($) {
$.extend($.summernote.plugins, {
'specialchars': function(context) {
var self = this;
var ui = $.summernote.ui;
var $editor = context.layoutInfo.editor;
var options = context.options;
var lang = options.langInfo;
var KEY = {
UP: 38,
DOWN: 40,
LEFT: 37,
RIGHT: 39,
ENTER: 13,
};
var COLUMN_LENGTH = 15;
var COLUMN_WIDTH = 35;
var currentColumn = 0;
var currentRow = 0;
var totalColumn = 0;
var totalRow = 0;
// special characters data set
var specialCharDataSet = [
'&quot;', '&amp;', '&lt;', '&gt;', '&iexcl;', '&cent;',
'&pound;', '&curren;', '&yen;', '&brvbar;', '&sect;',
'&uml;', '&copy;', '&ordf;', '&laquo;', '&not;',
'&reg;', '&macr;', '&deg;', '&plusmn;', '&sup2;',
'&sup3;', '&acute;', '&micro;', '&para;', '&middot;',
'&cedil;', '&sup1;', '&ordm;', '&raquo;', '&frac14;',
'&frac12;', '&frac34;', '&iquest;', '&times;', '&divide;',
'&fnof;', '&circ;', '&tilde;', '&ndash;', '&mdash;',
'&lsquo;', '&rsquo;', '&sbquo;', '&ldquo;', '&rdquo;',
'&bdquo;', '&dagger;', '&Dagger;', '&bull;', '&hellip;',
'&permil;', '&prime;', '&Prime;', '&lsaquo;', '&rsaquo;',
'&oline;', '&frasl;', '&euro;', '&image;', '&weierp;',
'&real;', '&trade;', '&alefsym;', '&larr;', '&uarr;',
'&rarr;', '&darr;', '&harr;', '&crarr;', '&lArr;',
'&uArr;', '&rArr;', '&dArr;', '&hArr;', '&forall;',
'&part;', '&exist;', '&empty;', '&nabla;', '&isin;',
'&notin;', '&ni;', '&prod;', '&sum;', '&minus;',
'&lowast;', '&radic;', '&prop;', '&infin;', '&ang;',
'&and;', '&or;', '&cap;', '&cup;', '&int;',
'&there4;', '&sim;', '&cong;', '&asymp;', '&ne;',
'&equiv;', '&le;', '&ge;', '&sub;', '&sup;',
'&nsub;', '&sube;', '&supe;', '&oplus;', '&otimes;',
'&perp;', '&sdot;', '&lceil;', '&rceil;', '&lfloor;',
'&rfloor;', '&loz;', '&spades;', '&clubs;', '&hearts;',
'&diams;',
];
context.memo('button.specialchars', function() {
return ui.button({
contents: '<i class="fa fa-font fa-flip-vertical">',
tooltip: lang.specialChar.specialChar,
click: function() {
self.show();
},
}).render();
});
/**
* Make Special Characters Table
*
* @member plugin.specialChar
* @private
* @return {jQuery}
*/
this.makeSpecialCharSetTable = function() {
var $table = $('<table/>');
$.each(specialCharDataSet, function(idx, text) {
var $td = $('<td/>').addClass('note-specialchar-node');
var $tr = (idx % COLUMN_LENGTH === 0) ? $('<tr/>') : $table.find('tr').last();
var $button = ui.button({
callback: function($node) {
$node.html(text);
$node.attr('title', text);
$node.attr('data-value', encodeURIComponent(text));
$node.css({
width: COLUMN_WIDTH,
'margin-right': '2px',
'margin-bottom': '2px',
});
},
}).render();
$td.append($button);
$tr.append($td);
if (idx % COLUMN_LENGTH === 0) {
$table.append($tr);
}
});
totalRow = $table.find('tr').length;
totalColumn = COLUMN_LENGTH;
return $table;
};
this.initialize = function() {
var $container = options.dialogsInBody ? $(document.body) : $editor;
var body = '<div class="form-group row-fluid">' + this.makeSpecialCharSetTable()[0].outerHTML + '</div>';
this.$dialog = ui.dialog({
title: lang.specialChar.select,
body: body,
}).render().appendTo($container);
};
this.show = function() {
var text = context.invoke('editor.getSelectedText');
context.invoke('editor.saveRange');
this.showSpecialCharDialog(text).then(function(selectChar) {
context.invoke('editor.restoreRange');
// build node
var $node = $('<span></span>').html(selectChar)[0];
if ($node) {
// insert video node
context.invoke('editor.insertNode', $node);
}
}).fail(function() {
context.invoke('editor.restoreRange');
});
};
/**
* show image dialog
*
* @param {jQuery} $dialog
* @return {Promise}
*/
this.showSpecialCharDialog = function(text) {
return $.Deferred(function(deferred) {
var $specialCharDialog = self.$dialog;
var $specialCharNode = $specialCharDialog.find('.note-specialchar-node');
var $selectedNode = null;
var ARROW_KEYS = [KEY.UP, KEY.DOWN, KEY.LEFT, KEY.RIGHT];
var ENTER_KEY = KEY.ENTER;
function addActiveClass($target) {
if (!$target) {
return;
}
$target.find('button').addClass('active');
$selectedNode = $target;
}
function removeActiveClass($target) {
$target.find('button').removeClass('active');
$selectedNode = null;
}
// find next node
function findNextNode(row, column) {
var findNode = null;
$.each($specialCharNode, function(idx, $node) {
var findRow = Math.ceil((idx + 1) / COLUMN_LENGTH);
var findColumn = ((idx + 1) % COLUMN_LENGTH === 0) ? COLUMN_LENGTH : (idx + 1) % COLUMN_LENGTH;
if (findRow === row && findColumn === column) {
findNode = $node;
return false;
}
});
return $(findNode);
}
function arrowKeyHandler(keyCode) {
// left, right, up, down key
var $nextNode;
var lastRowColumnLength = $specialCharNode.length % totalColumn;
if (KEY.LEFT === keyCode) {
if (currentColumn > 1) {
currentColumn = currentColumn - 1;
} else if (currentRow === 1 && currentColumn === 1) {
currentColumn = lastRowColumnLength;
currentRow = totalRow;
} else {
currentColumn = totalColumn;
currentRow = currentRow - 1;
}
} else if (KEY.RIGHT === keyCode) {
if (currentRow === totalRow && lastRowColumnLength === currentColumn) {
currentColumn = 1;
currentRow = 1;
} else if (currentColumn < totalColumn) {
currentColumn = currentColumn + 1;
} else {
currentColumn = 1;
currentRow = currentRow + 1;
}
} else if (KEY.UP === keyCode) {
if (currentRow === 1 && lastRowColumnLength < currentColumn) {
currentRow = totalRow - 1;
} else {
currentRow = currentRow - 1;
}
} else if (KEY.DOWN === keyCode) {
currentRow = currentRow + 1;
}
if (currentRow === totalRow && currentColumn > lastRowColumnLength) {
currentRow = 1;
} else if (currentRow > totalRow) {
currentRow = 1;
} else if (currentRow < 1) {
currentRow = totalRow;
}
$nextNode = findNextNode(currentRow, currentColumn);
if ($nextNode) {
removeActiveClass($selectedNode);
addActiveClass($nextNode);
}
}
function enterKeyHandler() {
if (!$selectedNode) {
return;
}
deferred.resolve(decodeURIComponent($selectedNode.find('button').attr('data-value')));
$specialCharDialog.modal('hide');
}
function keyDownEventHandler(event) {
event.preventDefault();
var keyCode = event.keyCode;
if (keyCode === undefined || keyCode === null) {
return;
}
// check arrowKeys match
if (ARROW_KEYS.indexOf(keyCode) > -1) {
if ($selectedNode === null) {
addActiveClass($specialCharNode.eq(0));
currentColumn = 1;
currentRow = 1;
return;
}
arrowKeyHandler(keyCode);
} else if (keyCode === ENTER_KEY) {
enterKeyHandler();
}
return false;
}
// remove class
removeActiveClass($specialCharNode);
// find selected node
if (text) {
for (var i = 0; i < $specialCharNode.length; i++) {
var $checkNode = $($specialCharNode[i]);
if ($checkNode.text() === text) {
addActiveClass($checkNode);
currentRow = Math.ceil((i + 1) / COLUMN_LENGTH);
currentColumn = (i + 1) % COLUMN_LENGTH;
}
}
}
ui.onDialogShown(self.$dialog, function() {
$(document).on('keydown', keyDownEventHandler);
self.$dialog.find('button').tooltip();
$specialCharNode.on('click', function(event) {
event.preventDefault();
deferred.resolve(decodeURIComponent($(event.currentTarget).find('button').attr('data-value')));
ui.hideDialog(self.$dialog);
});
});
ui.onDialogHidden(self.$dialog, function() {
$specialCharNode.off('click');
self.$dialog.find('button').tooltip('destroy');
$(document).off('keydown', keyDownEventHandler);
if (deferred.state() === 'pending') {
deferred.reject();
}
});
ui.showDialog(self.$dialog);
});
};
},
});
}));
@@ -0,0 +1,182 @@
/* https://github.com/DiemenDesign/summernote-cleaner */
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('jquery'));
} else {
factory(window.jQuery);
}
}
(function ($) {
$.extend(true, $.summernote.lang, {
'en-US': {
cleaner: {
tooltip: 'Cleaner',
not: 'Text has been Cleaned!!!',
limitText: 'Text',
limitHTML: 'HTML'
}
}
});
$.extend($.summernote.options, {
cleaner: {
action: 'both', // both|button|paste 'button' only cleans via toolbar button, 'paste' only clean when pasting content, both does both options.
newline: '<br>', // Summernote's default is to use '<p><br></p>'
notStyle: 'position:absolute;top:0;left:0;right:0',
icon: '<i class="note-icon"><svg xmlns="http://www.w3.org/2000/svg" id="libre-paintbrush" viewBox="0 0 14 14" width="14" height="14"><path d="m 11.821425,1 q 0.46875,0 0.82031,0.311384 0.35157,0.311384 0.35157,0.780134 0,0.421875 -0.30134,1.01116 -2.22322,4.212054 -3.11384,5.035715 -0.64956,0.609375 -1.45982,0.609375 -0.84375,0 -1.44978,-0.61942 -0.60603,-0.61942 -0.60603,-1.469866 0,-0.857143 0.61608,-1.419643 l 4.27232,-3.877232 Q 11.345985,1 11.821425,1 z m -6.08705,6.924107 q 0.26116,0.508928 0.71317,0.870536 0.45201,0.361607 1.00781,0.508928 l 0.007,0.475447 q 0.0268,1.426339 -0.86719,2.32366 Q 5.700895,13 4.261155,13 q -0.82366,0 -1.45982,-0.311384 -0.63616,-0.311384 -1.0212,-0.853795 -0.38505,-0.54241 -0.57924,-1.225446 -0.1942,-0.683036 -0.1942,-1.473214 0.0469,0.03348 0.27455,0.200893 0.22768,0.16741 0.41518,0.29799 0.1875,0.130581 0.39509,0.24442 0.20759,0.113839 0.30804,0.113839 0.27455,0 0.3683,-0.247767 0.16741,-0.441965 0.38505,-0.753349 0.21763,-0.311383 0.4654,-0.508928 0.24776,-0.197545 0.58928,-0.31808 0.34152,-0.120536 0.68974,-0.170759 0.34821,-0.05022 0.83705,-0.07031 z"/></svg></i>',
keepHtml: true, //Remove all Html formats
keepOnlyTags: [], // If keepHtml is true, remove all tags except these
keepClasses: false, //Remove Classes
badTags: ['style', 'script', 'applet', 'embed', 'noframes', 'noscript', 'html'], //Remove full tags with contents
badAttributes: ['style', 'start'], //Remove attributes from remaining tags
limitChars: 0, // 0|# 0 disables option
limitDisplay: 'both', // none|text|html|both
limitStop: false // true/false
}
});
$.extend($.summernote.plugins, {
'cleaner': function (context) {
var self = this,
ui = $.summernote.ui,
$note = context.layoutInfo.note,
$editor = context.layoutInfo.editor,
options = context.options,
lang = options.langInfo;
var cleanText = function (txt, nlO) {
var out = txt;
if (!options.cleaner.keepClasses) {
var sS = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g;
out = txt.replace(sS, ' ');
}
var nL = /(\n)+/g;
out = out.replace(nL, nlO);
if (options.cleaner.keepHtml) {
var cS = new RegExp('<!--(.*?)-->', 'gi');
out = out.replace(cS, '');
var tS = new RegExp('<(/)*(meta|link|\\?xml:|st1:|o:|font)(.*?)>', 'gi');
out = out.replace(tS, '');
var bT = options.cleaner.badTags;
for (var i = 0; i < bT.length; i++) {
tS = new RegExp('<' + bT[i] + '\\b.*>.*</' + bT[i] + '>', 'gi');
out = out.replace(tS, '');
}
var allowedTags = options.cleaner.keepOnlyTags;
if (typeof(allowedTags) == "undefined") allowedTags = [];
if (allowedTags.length > 0) {
allowedTags = (((allowedTags||'') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
out = out.replace(tags, function($0, $1) {
return allowedTags.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
});
}
var bA = options.cleaner.badAttributes;
for (var ii = 0; ii < bA.length; ii++ ) {
//var aS=new RegExp(' ('+bA[ii]+'="(.*?)")|('+bA[ii]+'=\'(.*?)\')', 'gi');
var aS = new RegExp(' ' + bA[ii] + '=[\'|"](.*?)[\'|"]', 'gi');
out = out.replace(aS, '');
aS = new RegExp(' ' + bA[ii] + '[=0-9a-z]', 'gi');
out = out.replace(aS, '');
}
}
return out;
};
if (options.cleaner.action == 'both' || options.cleaner.action == 'button') {
context.memo('button.cleaner', function () {
var button = ui.button({
contents: options.cleaner.icon,
tooltip: lang.cleaner.tooltip,
container: 'body',
click: function () {
if ($note.summernote('createRange').toString())
$note.summernote('pasteHTML', $note.summernote('createRange').toString());
else
$note.summernote('code', cleanText($note.summernote('code')));
if ($editor.find('.note-status-output').length > 0)
$editor.find('.note-status-output').html('<div class="alert alert-success">' + lang.cleaner.not + '</div>');
}
});
return button.render();
});
}
this.events = {
'summernote.init': function () {
if ($.summernote.interface === 'lite') {
$("head").append('<style>.note-statusbar .pull-right{float:right!important}.note-status-output .text-muted{color:#777}.note-status-output .text-primary{color:#286090}.note-status-output .text-success{color:#3c763d}.note-status-output .text-info{color:#31708f}.note-status-output .text-warning{color:#8a6d3b}.note-status-output .text-danger{color:#a94442}.alert{margin:-7px 0 0 0;padding:7px 10px;border:1px solid transparent;border-radius:0}.alert .note-icon{margin-right:5px}.alert-success{color:#3c763d!important;background-color: #dff0d8 !important;border-color:#d6e9c6}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}</style>');
}
if (options.cleaner.limitChars != 0 || options.cleaner.limitDisplay != 'none') {
var textLength = $editor.find(".note-editable").text().replace(/(<([^>]+)>)/ig, "").replace(/( )/, " ");
var codeLength = $editor.find('.note-editable').html();
var lengthStatus = '';
if (textLength.length > options.cleaner.limitChars && options.cleaner.limitChars > 0)
lengthStatus += 'text-danger">';
else
lengthStatus += '">';
if (options.cleaner.limitDisplay == 'text' || options.cleaner.limitDisplay == 'both') lengthStatus += lang.cleaner.limitText + ': ' + textLength.length;
if (options.cleaner.limitDisplay == 'both') lengthStatus += ' / ';
if (options.cleaner.limitDisplay == 'html' || options.cleaner.limitDisplay == 'both') lengthStatus += lang.cleaner.limitHTML + ': ' + codeLength.length;
$editor.find('.note-status-output').html('<small class="pull-right ' + lengthStatus + '&nbsp;</small>');
}
},
'summernote.keydown': function (we, e) {
if (options.cleaner.limitChars != 0 || options.cleaner.limitDisplay != 'none') {
var textLength = $editor.find(".note-editable").text().replace(/(<([^>]+)>)/ig, "").replace(/( )/, " ");
var codeLength = $editor.find('.note-editable').html();
var lengthStatus = '';
if (options.cleaner.limitStop == true && textLength.length >= options.cleaner.limitChars) {
var key = e.keyCode;
allowed_keys = [8, 37, 38, 39, 40, 46]
if ($.inArray(key, allowed_keys) != -1) {
$editor.find('.cleanerLimit').removeClass('text-danger');
return true;
} else {
$editor.find('.cleanerLimit').addClass('text-danger');
e.preventDefault();
e.stopPropagation();
}
} else {
if (textLength.length > options.cleaner.limitChars && options.cleaner.limitChars > 0)
lengthStatus += 'text-danger">';
else
lengthStatus += '">';
if (options.cleaner.limitDisplay == 'text' || options.cleaner.limitDisplay == 'both')
lengthStatus += lang.cleaner.limitText + ': ' + textLength.length;
if (options.cleaner.limitDisplay == 'both')
lengthStatus += ' / ';
if (options.cleaner.limitDisplay == 'html' || options.cleaner.limitDisplay == 'both')
lengthStatus += lang.cleaner.limitHTML + ': ' + codeLength.length;
$editor.find('.note-status-output').html('<small class="cleanerLimit pull-right ' + lengthStatus + '&nbsp;</small>');
}
}
},
'summernote.paste': function (we, e) {
if (options.cleaner.action == 'both' || options.cleaner.action == 'paste') {
e.preventDefault();
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
msie = msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./);
var ffox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (msie)
var text = window.clipboardData.getData("text");
else
var text = e.originalEvent.clipboardData.getData(options.cleaner.keepHtml ? 'text/html' : 'text/plain');
if(text==''){
var clipboardData = (event.clipboardData || window.clipboardData);
var text = clipboardData.getData('text');
}
if (text) {
if (msie || ffox)
setTimeout(function () {
$note.summernote('pasteHTML', cleanText(text, options.cleaner.newline));
}, 1);
else
$note.summernote('pasteHTML', cleanText(text, options.cleaner.newline));
if ($editor.find('.note-status-output').length > 0)
$editor.find('.note-status-output').html('<div class="summernote-cleanerAlert alert alert-success">' + lang.cleaner.not + '</div>');
}
}
}
}
}
});
}));
@@ -0,0 +1,143 @@
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('jquery'));
} else {
factory(window.jQuery);
}
}(function ($) {
$.extend($.summernote.plugins, {
'emoji': function (context) {
var self = this;
var ui = $.summernote.ui;
var emojis = ['1', '2', '3', '4', '5','6'];
var chunk = function (val, chunkSize) {
var R = [];
for (var i = 0; i < val.length; i += chunkSize)
R.push(val.slice(i, i + chunkSize));
return R;
};
/*IE polyfill*/
if (!Array.prototype.filter) {
Array.prototype.filter = function (fun /*, thisp*/) {
var len = this.length >>> 0;
if (typeof fun != "function")
throw new TypeError();
var res = [];
var thisp = arguments[1];
for (var i = 0; i < len; i++) {
if (i in this) {
var val = this[i];
if (fun.call(thisp, val, i, this))
res.push(val);
}
}
return res;
};
}
var addListener = function () {
$(document).on('click', '.closeEmoji', function(){
$('#emoji-dropdown').modal('hide');
});
$(document).on('click', '.selectEmoji', function(){
var img = new Image();
img.src = '/plugins/pubs/summernote/plugin/emojis/'+$(this).attr('data-value')+'.png';
img.alt = $(this).attr('data-value');
img.className = 'emoji-icon-inline';
context.invoke('editor.insertNode', img);
});
};
var render = function (emojis) {
var emoList = '';
/*limit list to 24 images*/
var emojis = emojis;
var chunks = chunk(emojis, 6);
for (j = 0; j < chunks.length; j++) {
emoList += '<div class="row">';
for (var i = 0; i < chunks[j].length; i++) {
var emo = chunks[j][i];
emoList += '<div class="col-xs-2">' +
//'<a href="javascript:void(0)" class="selectEmoji closeEmoji" data-value="' + emo + '"><span class="emoji-icon" style="background-image: url(\'' + document.emojiSource + emo + '.png\');"></span></a>' +
'<a href="javascript:void(0)" class="selectEmoji closeEmoji" data-value="' + emo + '"><img src="' + document.emojiSource + emo + '.png" class="emoji-icon" /></a>' +
'</div>';
}
emoList += '</div>';
}
return emoList;
};
var filterEmoji = function (value) {
var filtered = emojis.filter(function (el) {
return el.indexOf(value) > -1;
});
return render(filtered);
};
// add emoji button
context.memo('button.emoji', function () {
// create button
var button = ui.button({
contents: '<i class="bi bi-emoji-smile"></i>',
//tooltip: 'emoji',
click: function () {
if(document.emojiSource === undefined)
document.emojiSource = '';
//self.$panel.show();
$('#emoji-dropdown').modal('show');
}
});
// create jQuery object from button instance.
var $emoji = button.render();
return $emoji;
});
// This events will be attached when editor is initialized.
this.events = {
// This will be called after modules are initialized.
'summernote.init': function (we, e) {
addListener();
},
// This will be called when user releases a key on editable.
'summernote.keyup': function (we, e) {
}
};
// This method will be called when editor is initialized by $('..').summernote();
// You can create elements for plugin
this.initialize = function () {
this.$panel = $('<div class="modal fade" role="dialog" id="emoji-dropdown">' +
'<div class="modal-dialog">'+
'<div class="modal-content">'+
'<div class="modal-header">插入表情'+
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>'+
'</div>'+
'<div class="modal-body">'+
'<div class="emoji-list">' +
render(emojis) +
'</div>' +
'</div>'+
'</div>'+
'</div>'+
'</div>').hide();
this.$panel.appendTo('body');
};
this.destroy = function () {
this.$panel.remove();
this.$panel = null;
};
}
});
}));
@@ -0,0 +1,197 @@
/*!
* summernote highlight plugin
* http://www.hyl.pw/
*
* Released under the MIT license
*/
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals: jQuery
factory(window.jQuery);
}
}(function ($) {
// Extends plugins for adding highlight.
// - plugin is external module for customizing.
$.extend($.summernote.plugins, {
/**
* @param {Object} context - context object has status of editor.
*/
'highlight': function (context) {
var self = this;
var ui = $.summernote.ui;
var $editor = context.layoutInfo.editor;
var options = context.options;
var lang = options.langInfo;
// add button
context.memo('button.highlight', function () {
// create button
var button = ui.button({
contents: '<i class="bi bi-code"></i>',
tooltip: 'highlight',
click: function () {
self.show()
}
});
// create jQuery object from button instance.
var $highlight = button.render();
return $highlight;
});
this.createDialog = function () {
var $box = $('<div />');
var $selectGroup = $('<div class="form-group" />');
var $textGroup = $('<div class="form-group" />');
var $select = $('<select class="form-control ext-highlight-select" />');
var languages = [
'bsh', 'c', 'cc', 'cpp', 'cs', 'csh', 'cyc', 'cv', 'htm', 'html',
'java', 'js', 'm', 'mxml', 'perl', 'pl', 'pm', 'py', 'php', 'rb',
'sh', 'xhtml', 'xml', 'xsl'
];
for (var i = 0; i < languages.length; i++) {
$select.append('<option value="' + languages[i] + '">' + languages[i] + '</option>');
}
var $label = $('<label />');
$label.html('选择语言');
$box.append($selectGroup.append($label));
$box.append($selectGroup.append($select));
var $label = $('<label />');
$label.html('输入代码片段');
var $textarea = $('<textarea class="ext-highlight-code form-control" rows="10" />');
$box.append($textGroup.append($label));
$box.append($textGroup.append($textarea));
return $box.html();
};
this.createCodeNode = function (code, select) {
var $code = $('<code>');
$code.html(code);
$code.addClass('language-' + select);
var $pre = $('<pre>');
$pre.html($code)
$pre.addClass('prettyprint').addClass('linenums');
return $pre[0];
};
this.showHighlightDialog = function (codeInfo) {
return $.Deferred(function (deferred) {
var $extHighlightCode = self.$dialog.find('.ext-highlight-code');
var $extHighlightBtn = self.$dialog.find('.ext-highlight-btn');
var $extHighlightSelect = self.$dialog.find('.ext-highlight-select');
ui.onDialogShown(self.$dialog, function () {
$extHighlightCode.val(codeInfo);
$extHighlightCode.on('input', function () {
ui.toggleBtn($extHighlightBtn, $extHighlightCode.val() != '');
codeInfo = $extHighlightCode.val();
});
$extHighlightBtn.one('click', function (event) {
event.preventDefault();
deferred.resolve(self.createCodeNode($extHighlightCode.val(), $extHighlightSelect.val()));
ui.hideDialog(self.$dialog);
});
});
ui.onDialogHidden(self.$dialog, function () {
$extHighlightBtn.off('click');
if (deferred.state() === 'pending') {
deferred.reject();
}
});
ui.showDialog(self.$dialog);
});
};
this.getCodeInfo = function () {
var text = context.invoke('editor.getSelectedText');
return '';
};
this.show = function () {
var codeInfo = self.getCodeInfo();
context.invoke('editor.saveRange');
this.showHighlightDialog(codeInfo).then(function (codeInfo) {
self.$dialog.modal('hide');
context.invoke('editor.restoreRange');
if (codeInfo) {
context.invoke('editor.insertNode', codeInfo);
}
});
};
//// This events will be attached when editor is initialized.
//this.event = {
// // This will be called after modules are initialized.
// 'summernote.init': function (we, e) {
// console.log('summernote initialized', we, e);
// },
// // This will be called when user releases a key on editable.
// 'summernote.keyup': function (we, e) {
// console.log('summernote keyup', we, e);
// }
//};
//
//// This method will be called when editor is initialized by $('..').summernote();
//// You can create elements for plugin
this.initialize = function () {
var $container = options.dialogsInBody ? $(document.body) : $editor;
var body = [
'<button href="#" class="btn btn-primary ext-highlight-btn disabled" disabled>',
'插入代码',
'</button>'
].join('');
this.$dialog = ui.dialog({
className: 'ext-highlight',
title: '插入代码',
body: this.createDialog(),
footer: body,
//callback: function ($node) {
// $node.find('.modal-body').css({
// 'max-height': 300,
// 'overflow': 'scroll'
// });
//}
}).render().appendTo($container);
};
// This methods will be called when editor is destroyed by $('..').summernote('destroy');
// You should remove elements on `initialize`.
this.destroy = function () {
ui.hideDialog(this.$dialog);
this.$dialog.remove();
};
}
});
}));
@@ -0,0 +1,118 @@
(function (factory) {
/* global define */
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Browser globals: jQuery
factory(window.jQuery);
}
}(function ($) {
$.extend($.summernote.plugins, {
'ts_video': function (context) {
var self = this;
var ui = $.summernote.ui;
var $editor = context.layoutInfo.editor;
var options = context.options;
var lang = options.langInfo;
context.memo('button.ts_video', function () {
var button = ui.button({
contents: '<i class="fab fa-youtube"></i>',
tooltip: 'ts_video',
click: function () {
self.show()
}
});
// create jQuery object from button instance.
var $highlight = button.render();
return $highlight;
});
this.createDialog = function () {
var $box = $('<div />');
var $frame = $('<iframe width="100%" height="444" frameborder="0" scrolling="no" src="'+siteUrl+'index.php?app=video&ac=editor&ts=list" />');
$box.append($frame);
return $box.html();
};
this.showAttachDialog = function () {
return $.Deferred(function () {
ui.onDialogShown(self.$dialog, function () {
});
ui.onDialogHidden(self.$dialog, function () {
});
ui.showDialog(self.$dialog);
});
};
this.show = function () {
this.showAttachDialog().then(function () {
self.$dialog.modal('hide');
context.invoke('editor.restoreRange');
});
};
this.initialize = function () {
var $container = options.dialogsInBody ? $(document.body) : $editor;
var body = [''].join('');
this.$dialog = ui.dialog({
className: 'ts-video',
title: '我的视频',
body: this.createDialog(),
footer: body,
//callback: function ($node) {
// $node.find('.modal-body').css({
// 'max-height': 300,
// 'overflow': 'scroll'
// });
//}
}).render().appendTo($container);
};
this.destroy = function () {
ui.hideDialog(this.$dialog);
this.$dialog.remove();
};
}
})
}))
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
/*! Summernote v0.8.18 | (c) 2013- Alan Hong and other contributors | MIT license */
File diff suppressed because one or more lines are too long
+34
View File
@@ -0,0 +1,34 @@
<?php
defined('IN_TS') or die('Access Denied.');
function summernote($loadjs='load'){
if($loadjs!='load'){
$loadjs='load_'.$loadjs;
}
#判断手机访问
if($loadjs=='load' && isMobile()==true){
$loadjs = 'load_m';
}
if($GLOBALS['TS_USER']) {
echo '<link href="' . SITE_URL . 'plugins/pubs/summernote/summernote-lite.css?v=2022" rel="stylesheet">';
echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/summernote-lite.js"></script>';
echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/lang/summernote-zh-CN.js"></script>';
#插入代码插件
echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/summernote-ext-highlight.js?v=202109060947"></script>';
#过滤html
echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/summernote-cleaner.js"></script>';
#附件插件
if(is_file('plugins/pubs/summernote/plugin/attach/attach.js')) echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/attach/attach.js?v=2021"></script>';
#视频插件
if(is_file('plugins/pubs/summernote/plugin/video/video.js')) echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/video/video.js?v=2021"></script>';
#音频插件
if(is_file('plugins/pubs/summernote/plugin/audio/audio.js')) echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/audio/audio.js?v=2021"></script>';
#表情
if(is_file('plugins/pubs/summernote/plugin/summernote-ext-emoji.js')) echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/plugin/summernote-ext-emoji.js?v=20210826"></script>';
echo '<script src="' . SITE_URL . 'plugins/pubs/summernote/' . $loadjs . '.js?v=' . rand() . '"></script>';
}
}
addAction('tseditor','summernote');