imatrix-ui 2.8.97-dw-tmp3 → 2.8.97-dw-tmp5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.umd.min.js +54 -3
- package/package.json +12 -10
- package/src/permission111.js +105 -0
- package/src/plugins.js +1 -1
- package/src/store/modules/permission.js +5 -0
- package/src/styles/index.scss +2 -2
- package/src/utils/permissionAuth.js +6 -0
- package/src/views/login/index.vue +1 -1
- package/lib/super-ui.common.1.js +0 -368
- package/lib/super-ui.common.2.js +0 -30088
- package/lib/super-ui.umd.1.js +0 -368
- package/lib/super-ui.umd.2.js +0 -30088
- package/lib/super-ui.umd.min.1.js +0 -2
- package/lib/super-ui.umd.min.2.js +0 -2
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imatrix-ui",
|
|
3
|
-
"version": "2.8.97-dw-
|
|
3
|
+
"version": "2.8.97-dw-tmp5",
|
|
4
4
|
"description": "前端组件库:表格、表单、组织结构树等",
|
|
5
5
|
"main": "lib/super-ui.umd.min.js",
|
|
6
6
|
"private": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"serve": "vue-cli-service serve",
|
|
9
9
|
"build": "vue-cli-service build",
|
|
10
|
-
"lib": "vue-cli-service build --modern --target lib --name super-ui --dest lib packages/index.js
|
|
10
|
+
"lib": "vue-cli-service build --modern --target lib --name super-ui --dest lib packages/index.js",
|
|
11
11
|
"lint": "vue-cli-service lint",
|
|
12
12
|
"test:e2e": "vue-cli-service test:e2e",
|
|
13
13
|
"test:unit": "vue-cli-service test:unit"
|
|
14
14
|
},
|
|
15
|
-
"dependencies": {
|
|
16
|
-
"devDependencies": {
|
|
15
|
+
"dependencies": {
|
|
17
16
|
"@tinymce/tinymce-vue": "^3.2.4",
|
|
17
|
+
"@zxing/library": "^0.19.1",
|
|
18
|
+
"js-cookie": "^2.2.0",
|
|
19
|
+
"sortablejs": "1.10.2",
|
|
20
|
+
"tinymce": "^5.6.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
18
23
|
"@vue/cli-plugin-babel": "3.8.0",
|
|
19
24
|
"@vue/cli-plugin-e2e-cypress": "3.8.0",
|
|
20
25
|
"@vue/cli-plugin-eslint": "3.8.0",
|
|
@@ -22,22 +27,19 @@
|
|
|
22
27
|
"@vue/cli-service": "3.8.0",
|
|
23
28
|
"@vue/eslint-config-standard": "^4.0.0",
|
|
24
29
|
"@vue/test-utils": "^1.0.0-beta.29",
|
|
25
|
-
"@zxing/library": "^0.19.1",
|
|
26
30
|
"axios": "0.19.0",
|
|
27
31
|
"babel-cli": "^6.26.0",
|
|
28
32
|
"babel-eslint": "^10.0.1",
|
|
33
|
+
"babel-plugin-component": "^1.1.1",
|
|
29
34
|
"chai": "4.2.0",
|
|
35
|
+
"compression-webpack-plugin": "2.0.0",
|
|
30
36
|
"element-ui": "2.15.3",
|
|
31
37
|
"eslint": "5.16.0",
|
|
32
38
|
"eslint-plugin-vue": "5.2.2",
|
|
33
|
-
"
|
|
34
|
-
"node-sass": "4.12.0",
|
|
39
|
+
"node-sass": "4.14.0",
|
|
35
40
|
"nprogress": "^0.2.0",
|
|
36
41
|
"sass-loader": "^7.1.0",
|
|
37
42
|
"sessionstorage": "^0.1.0",
|
|
38
|
-
"sortablejs": "1.10.2",
|
|
39
|
-
"tinymce": "^5.6.1",
|
|
40
|
-
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
41
43
|
"vue": "^2.6.10",
|
|
42
44
|
"vue-cli-plugin-element": "^1.0.1",
|
|
43
45
|
"vue-i18n": "^8.17.4",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import NProgress from 'nprogress' // Progress 进度条
|
|
2
|
+
import 'nprogress/nprogress.css'// Progress 进度条样式
|
|
3
|
+
import { getToken, setToken } from './utils/auth' // 验权
|
|
4
|
+
import store from './store'
|
|
5
|
+
import router, { errorRouterMap } from './router'
|
|
6
|
+
NProgress.configure({ showSpinner: false })// NProgress Configuration
|
|
7
|
+
import { Message } from 'element-ui'
|
|
8
|
+
import Vue from 'vue'
|
|
9
|
+
|
|
10
|
+
const whiteList = ['/login', '/update-password', '/forget-password', '/reset-password', '/redirect'] // 不重定向白名单
|
|
11
|
+
router.beforeEach((to, from, next) => {
|
|
12
|
+
NProgress.start()
|
|
13
|
+
console.log('router.beforeEach-to=', to)
|
|
14
|
+
console.log('router.beforeEach-from=', from)
|
|
15
|
+
// console.log('router.beforeEach-to.path=', to.path)
|
|
16
|
+
let token = getToken()
|
|
17
|
+
// console.log('router.beforeEach-to.query.JWT=', to.query.JWT)
|
|
18
|
+
if (!token && to.query && to.query.JWT) {
|
|
19
|
+
token = to.query.JWT
|
|
20
|
+
if (token) {
|
|
21
|
+
// 微信小程序web-view直接访问路径时使用?将JWT传过来
|
|
22
|
+
setToken(token)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!token && to.query && to.query.jwt) {
|
|
26
|
+
token = to.query.jwt
|
|
27
|
+
if (token) {
|
|
28
|
+
// 微信小程序web-view直接访问路径时使用?将JWT传过来
|
|
29
|
+
setToken(token)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (to.query && to.query._systemName_) {
|
|
33
|
+
// 表示需要设置浏览器页签名
|
|
34
|
+
document.title = to.query._systemName_
|
|
35
|
+
}
|
|
36
|
+
// console.log('router.beforeEach-getToken()=', token)
|
|
37
|
+
if ((['/update-password', '/forget-password', '/reset-password', '/redirect'].indexOf(to.path) === -1 || store.getters.whiteList.indexOf(to.path) !== -1) && token) {
|
|
38
|
+
if (to.path === '/login') {
|
|
39
|
+
next({ path: '/', query: to.query })
|
|
40
|
+
NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
|
|
41
|
+
} else {
|
|
42
|
+
console.log('router.beforeEach-to.path!=login')
|
|
43
|
+
if (store.getters.name === '') {
|
|
44
|
+
// 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
|
|
45
|
+
console.log('router.beforeEach-store.getters.name === ""')
|
|
46
|
+
store.dispatch('isLoginTimeOut').then((result) => {
|
|
47
|
+
if (result === true) {
|
|
48
|
+
store.dispatch('clearToken').then(() => {
|
|
49
|
+
next({ path: '/', replace: true })
|
|
50
|
+
NProgress.done()
|
|
51
|
+
})
|
|
52
|
+
} else {
|
|
53
|
+
store.dispatch('getCurrentUser').then(user => {
|
|
54
|
+
console.log('router.beforeEach-getCurrentUser')
|
|
55
|
+
return store.dispatch('getCurrentUserPermissions', user.loginName)
|
|
56
|
+
}).then(permissions => {
|
|
57
|
+
console.log('router.beforeEach-getCurrentUserPermissions-result==')
|
|
58
|
+
return store.dispatch('generateRoutes', permissions)
|
|
59
|
+
}).then(() => {
|
|
60
|
+
console.log('iMatrix-router.beforeEach2-getPermissionMenus')
|
|
61
|
+
return store.dispatch('getPermissionMenus', Vue.prototype.currentSystem)
|
|
62
|
+
}).then(() => {
|
|
63
|
+
// 根据roles权限生成可访问的路由表
|
|
64
|
+
console.log('router.beforeEach-generateRoutes==to=', to, ',from=', from)
|
|
65
|
+
router.addRoutes(store.getters.protectedRouters) // 动态添加可访问路由表
|
|
66
|
+
// 404等错误路由一定要放到受权限保护的路由之后
|
|
67
|
+
router.addRoutes(errorRouterMap)
|
|
68
|
+
sessionStorage.setItem(new Date().getTime() + '-name=null-from~~toPath', from.path + '~~' + to.path)
|
|
69
|
+
console.log('router.beforeEach-generateRoutes==to.path=', to.path)
|
|
70
|
+
next({ ...to, replace: true })
|
|
71
|
+
}).catch((err) => {
|
|
72
|
+
store.dispatch('clearToken').then(() => {
|
|
73
|
+
Message.error(err || 'Verification failed, please login again')
|
|
74
|
+
next({ path: '/' })
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}).catch((err) => {
|
|
79
|
+
store.dispatch('clearToken').then(() => {
|
|
80
|
+
Message.error(err || 'Verification failed, please login again')
|
|
81
|
+
next({ path: '/' })
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
} else {
|
|
85
|
+
sessionStorage.setItem(new Date().getTime() + '-name!==null-from~~toPath', from.path + '~~' + to.path)
|
|
86
|
+
console.log('router.beforeEach-store.getters.name ==', store.getters.name)
|
|
87
|
+
next()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
if (whiteList.indexOf(to.path) !== -1 || store.getters.whiteList.indexOf(to.path) !== -1) {
|
|
92
|
+
next()
|
|
93
|
+
} else {
|
|
94
|
+
// 必须使用to.fullPath,fullPath是带有参数的,to.path没有参数,会导致跳转到的页面参数丢失
|
|
95
|
+
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
|
96
|
+
NProgress.done()
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const r2 = new Date().getTime()
|
|
100
|
+
console.log('路由导航所用时间', r2 - r1)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
router.afterEach(() => {
|
|
104
|
+
NProgress.done() // 结束Progress
|
|
105
|
+
})
|
package/src/plugins.js
CHANGED
|
@@ -8,7 +8,7 @@ import '@gcommon/gcommon-ui/lib/theme-chalk/index.css'
|
|
|
8
8
|
import locale from '@gcommon/gcommon-ui/lib/locale/lang/zh-CN' // lang i18n
|
|
9
9
|
|
|
10
10
|
import SuperUI from 'imatrix-ui'
|
|
11
|
-
|
|
11
|
+
import 'imatrix-ui/lib/super-ui.css'
|
|
12
12
|
|
|
13
13
|
import 'imatrix-ui/src/permission' // permission control
|
|
14
14
|
import permission from 'imatrix-ui/src/directives/permission'
|
|
@@ -86,7 +86,10 @@ const permission = {
|
|
|
86
86
|
return new Promise(resolve => {
|
|
87
87
|
const currentUserPermissions = data
|
|
88
88
|
// commit('setCurrentUserPermissions', currentUserPermissions)
|
|
89
|
+
const a = new Date().getTime()
|
|
89
90
|
const accessableRoutersResult = filterProtectedRouter(protectedRouterMap, currentUserPermissions)
|
|
91
|
+
const b = new Date().getTime()
|
|
92
|
+
sessionStorage.setItem('generateRoutes==>执行时间:', (b - a) + '')
|
|
90
93
|
const accessableRouters = accessableRoutersResult.allRouters
|
|
91
94
|
const allMenuRoutes = accessableRoutersResult.menuRouters
|
|
92
95
|
// console.log('有权限的路由表结果==', accessableRouters)
|
|
@@ -115,6 +118,8 @@ const permission = {
|
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
commit('setRouters', accessableRouters)
|
|
121
|
+
const c = new Date().getTime()
|
|
122
|
+
sessionStorage.setItem('generateRoutes==>执行时间c-a:', (c - a) + '')
|
|
118
123
|
resolve()
|
|
119
124
|
})
|
|
120
125
|
}
|
package/src/styles/index.scss
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
@import './theme/blue2/sidebar.scss';
|
|
10
10
|
@import './theme/gray/index.scss';
|
|
11
11
|
@import './theme/gray/sidebar.scss';
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
@import './theme/dark-blue/index.scss';
|
|
13
|
+
@import './theme/dark-blue/sidebar.scss';
|
|
14
14
|
@import './display-layout.scss';
|
|
15
15
|
|
|
16
16
|
body {
|
|
@@ -18,15 +18,19 @@ export function getSystemCode() {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function getPermissions() {
|
|
21
|
+
const a = new Date().getTime()
|
|
21
22
|
const systemCode = getSystemCode()
|
|
22
23
|
const permissions = sessionStorage.getItem(permissionKey + systemCode)
|
|
23
24
|
if (permissions) {
|
|
24
25
|
return JSON.parse(permissions)
|
|
25
26
|
}
|
|
27
|
+
const b = new Date().getTime()
|
|
28
|
+
sessionStorage.setItem('getPermissions==>执行时间:', (b - a) + '')
|
|
26
29
|
return null
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export function setPermissions(permissions) {
|
|
33
|
+
const a = new Date().getTime()
|
|
30
34
|
const systemCode = getSystemCode()
|
|
31
35
|
const permissionObjs = {}
|
|
32
36
|
for (let i = 0; i < permissions.length; i++) {
|
|
@@ -34,6 +38,8 @@ export function setPermissions(permissions) {
|
|
|
34
38
|
permissionObjs[permission] = true
|
|
35
39
|
}
|
|
36
40
|
sessionStorage.setItem(permissionKey + systemCode, JSON.stringify(permissionObjs))
|
|
41
|
+
const b = new Date().getTime()
|
|
42
|
+
sessionStorage.setItem('setPermissions==>执行时间:', (b - a) + '')
|
|
37
43
|
return permissionObjs
|
|
38
44
|
}
|
|
39
45
|
|
package/lib/super-ui.common.1.js
DELETED
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
((typeof self !== 'undefined' ? self : this)["webpackJsonpsuper_ui"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpsuper_ui"] || []).push([[1],{
|
|
2
|
-
|
|
3
|
-
/***/ "c4a9":
|
|
4
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
5
|
-
|
|
6
|
-
"use strict";
|
|
7
|
-
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getTinymce; });
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
var getGlobal = function () { return (typeof window !== 'undefined' ? window : global); };
|
|
16
|
-
var getTinymce = function () {
|
|
17
|
-
var global = getGlobal();
|
|
18
|
-
return global && global.tinymce ? global.tinymce : null;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba")))
|
|
23
|
-
|
|
24
|
-
/***/ }),
|
|
25
|
-
|
|
26
|
-
/***/ "ca72":
|
|
27
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
28
|
-
|
|
29
|
-
"use strict";
|
|
30
|
-
__webpack_require__.r(__webpack_exports__);
|
|
31
|
-
|
|
32
|
-
// CONCATENATED MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/Utils.js
|
|
33
|
-
/**
|
|
34
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
37
|
-
* LICENSE file in the root directory of this source tree.
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
var validEvents = [
|
|
41
|
-
'onActivate',
|
|
42
|
-
'onAddUndo',
|
|
43
|
-
'onBeforeAddUndo',
|
|
44
|
-
'onBeforeExecCommand',
|
|
45
|
-
'onBeforeGetContent',
|
|
46
|
-
'onBeforeRenderUI',
|
|
47
|
-
'onBeforeSetContent',
|
|
48
|
-
'onBeforePaste',
|
|
49
|
-
'onBlur',
|
|
50
|
-
'onChange',
|
|
51
|
-
'onClearUndos',
|
|
52
|
-
'onClick',
|
|
53
|
-
'onContextMenu',
|
|
54
|
-
'onCopy',
|
|
55
|
-
'onCut',
|
|
56
|
-
'onDblclick',
|
|
57
|
-
'onDeactivate',
|
|
58
|
-
'onDirty',
|
|
59
|
-
'onDrag',
|
|
60
|
-
'onDragDrop',
|
|
61
|
-
'onDragEnd',
|
|
62
|
-
'onDragGesture',
|
|
63
|
-
'onDragOver',
|
|
64
|
-
'onDrop',
|
|
65
|
-
'onExecCommand',
|
|
66
|
-
'onFocus',
|
|
67
|
-
'onFocusIn',
|
|
68
|
-
'onFocusOut',
|
|
69
|
-
'onGetContent',
|
|
70
|
-
'onHide',
|
|
71
|
-
'onInit',
|
|
72
|
-
'onKeyDown',
|
|
73
|
-
'onKeyPress',
|
|
74
|
-
'onKeyUp',
|
|
75
|
-
'onLoadContent',
|
|
76
|
-
'onMouseDown',
|
|
77
|
-
'onMouseEnter',
|
|
78
|
-
'onMouseLeave',
|
|
79
|
-
'onMouseMove',
|
|
80
|
-
'onMouseOut',
|
|
81
|
-
'onMouseOver',
|
|
82
|
-
'onMouseUp',
|
|
83
|
-
'onNodeChange',
|
|
84
|
-
'onObjectResizeStart',
|
|
85
|
-
'onObjectResized',
|
|
86
|
-
'onObjectSelected',
|
|
87
|
-
'onPaste',
|
|
88
|
-
'onPostProcess',
|
|
89
|
-
'onPostRender',
|
|
90
|
-
'onPreProcess',
|
|
91
|
-
'onProgressState',
|
|
92
|
-
'onRedo',
|
|
93
|
-
'onRemove',
|
|
94
|
-
'onReset',
|
|
95
|
-
'onSaveContent',
|
|
96
|
-
'onSelectionChange',
|
|
97
|
-
'onSetAttrib',
|
|
98
|
-
'onSetContent',
|
|
99
|
-
'onShow',
|
|
100
|
-
'onSubmit',
|
|
101
|
-
'onUndo',
|
|
102
|
-
'onVisualAid'
|
|
103
|
-
];
|
|
104
|
-
var isValidKey = function (key) { return validEvents.map(function (event) { return event.toLowerCase(); }).indexOf(key.toLowerCase()) !== -1; };
|
|
105
|
-
var bindHandlers = function (initEvent, listeners, editor) {
|
|
106
|
-
Object.keys(listeners)
|
|
107
|
-
.filter(isValidKey)
|
|
108
|
-
.forEach(function (key) {
|
|
109
|
-
var handler = listeners[key];
|
|
110
|
-
if (typeof handler === 'function') {
|
|
111
|
-
if (key === 'onInit') {
|
|
112
|
-
handler(initEvent, editor);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
editor.on(key.substring(2), function (e) { return handler(e, editor); });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
var bindModelHandlers = function (ctx, editor) {
|
|
121
|
-
var modelEvents = ctx.$props.modelEvents ? ctx.$props.modelEvents : null;
|
|
122
|
-
var normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
|
|
123
|
-
editor.on(normalizedEvents ? normalizedEvents : 'change input undo redo', function () {
|
|
124
|
-
ctx.$emit('input', editor.getContent({ format: ctx.$props.outputFormat }));
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
var initEditor = function (initEvent, ctx, editor) {
|
|
128
|
-
var value = ctx.$props.value ? ctx.$props.value : '';
|
|
129
|
-
var initialValue = ctx.$props.initialValue ? ctx.$props.initialValue : '';
|
|
130
|
-
editor.setContent(value || (ctx.initialized ? ctx.cache : initialValue));
|
|
131
|
-
// Always bind the value listener in case users use :value instead of v-model
|
|
132
|
-
ctx.$watch('value', function (val, prevVal) {
|
|
133
|
-
if (editor && typeof val === 'string' && val !== prevVal && val !== editor.getContent({ format: ctx.$props.outputFormat })) {
|
|
134
|
-
editor.setContent(val);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
// checks if the v-model shorthand is used (which sets an v-on:input listener) and then binds either
|
|
138
|
-
// specified the events or defaults to "change keyup" event and emits the editor content on that event
|
|
139
|
-
if (ctx.$listeners.input) {
|
|
140
|
-
bindModelHandlers(ctx, editor);
|
|
141
|
-
}
|
|
142
|
-
bindHandlers(initEvent, ctx.$listeners, editor);
|
|
143
|
-
ctx.initialized = true;
|
|
144
|
-
};
|
|
145
|
-
var unique = 0;
|
|
146
|
-
var uuid = function (prefix) {
|
|
147
|
-
var time = Date.now();
|
|
148
|
-
var random = Math.floor(Math.random() * 1000000000);
|
|
149
|
-
unique++;
|
|
150
|
-
return prefix + '_' + random + unique + String(time);
|
|
151
|
-
};
|
|
152
|
-
var isTextarea = function (element) {
|
|
153
|
-
return element !== null && element.tagName.toLowerCase() === 'textarea';
|
|
154
|
-
};
|
|
155
|
-
var normalizePluginArray = function (plugins) {
|
|
156
|
-
if (typeof plugins === 'undefined' || plugins === '') {
|
|
157
|
-
return [];
|
|
158
|
-
}
|
|
159
|
-
return Array.isArray(plugins) ? plugins : plugins.split(' ');
|
|
160
|
-
};
|
|
161
|
-
var mergePlugins = function (initPlugins, inputPlugins) {
|
|
162
|
-
return normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
|
|
163
|
-
};
|
|
164
|
-
var isNullOrUndefined = function (value) { return value === null || value === undefined; };
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
// CONCATENATED MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/ScriptLoader.js
|
|
168
|
-
/**
|
|
169
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
170
|
-
*
|
|
171
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
172
|
-
* LICENSE file in the root directory of this source tree.
|
|
173
|
-
*
|
|
174
|
-
*/
|
|
175
|
-
|
|
176
|
-
var createState = function () {
|
|
177
|
-
return {
|
|
178
|
-
listeners: [],
|
|
179
|
-
scriptId: uuid('tiny-script'),
|
|
180
|
-
scriptLoaded: false
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
var CreateScriptLoader = function () {
|
|
184
|
-
var state = createState();
|
|
185
|
-
var injectScriptTag = function (scriptId, doc, url, callback) {
|
|
186
|
-
var scriptTag = doc.createElement('script');
|
|
187
|
-
scriptTag.referrerPolicy = 'origin';
|
|
188
|
-
scriptTag.type = 'application/javascript';
|
|
189
|
-
scriptTag.id = scriptId;
|
|
190
|
-
scriptTag.src = url;
|
|
191
|
-
var handler = function () {
|
|
192
|
-
scriptTag.removeEventListener('load', handler);
|
|
193
|
-
callback();
|
|
194
|
-
};
|
|
195
|
-
scriptTag.addEventListener('load', handler);
|
|
196
|
-
if (doc.head) {
|
|
197
|
-
doc.head.appendChild(scriptTag);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
var load = function (doc, url, callback) {
|
|
201
|
-
if (state.scriptLoaded) {
|
|
202
|
-
callback();
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
state.listeners.push(callback);
|
|
206
|
-
if (!doc.getElementById(state.scriptId)) {
|
|
207
|
-
injectScriptTag(state.scriptId, doc, url, function () {
|
|
208
|
-
state.listeners.forEach(function (fn) { return fn(); });
|
|
209
|
-
state.scriptLoaded = true;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
// Only to be used by tests.
|
|
215
|
-
var reinitialize = function () {
|
|
216
|
-
state = createState();
|
|
217
|
-
};
|
|
218
|
-
return {
|
|
219
|
-
load: load,
|
|
220
|
-
reinitialize: reinitialize
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
var ScriptLoader = CreateScriptLoader();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// EXTERNAL MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/TinyMCE.js
|
|
227
|
-
var TinyMCE = __webpack_require__("c4a9");
|
|
228
|
-
|
|
229
|
-
// CONCATENATED MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/EditorPropTypes.js
|
|
230
|
-
/**
|
|
231
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
234
|
-
* LICENSE file in the root directory of this source tree.
|
|
235
|
-
*
|
|
236
|
-
*/
|
|
237
|
-
var editorProps = {
|
|
238
|
-
apiKey: String,
|
|
239
|
-
cloudChannel: String,
|
|
240
|
-
id: String,
|
|
241
|
-
init: Object,
|
|
242
|
-
initialValue: String,
|
|
243
|
-
inline: Boolean,
|
|
244
|
-
modelEvents: [String, Array],
|
|
245
|
-
plugins: [String, Array],
|
|
246
|
-
tagName: String,
|
|
247
|
-
toolbar: [String, Array],
|
|
248
|
-
value: String,
|
|
249
|
-
disabled: Boolean,
|
|
250
|
-
tinymceScriptSrc: String,
|
|
251
|
-
outputFormat: {
|
|
252
|
-
type: String,
|
|
253
|
-
validator: function (prop) { return prop === 'html' || prop === 'text'; }
|
|
254
|
-
},
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
// CONCATENATED MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/components/Editor.js
|
|
258
|
-
/**
|
|
259
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
260
|
-
*
|
|
261
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
262
|
-
* LICENSE file in the root directory of this source tree.
|
|
263
|
-
*
|
|
264
|
-
*/
|
|
265
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
266
|
-
__assign = Object.assign || function(t) {
|
|
267
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
268
|
-
s = arguments[i];
|
|
269
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
270
|
-
t[p] = s[p];
|
|
271
|
-
}
|
|
272
|
-
return t;
|
|
273
|
-
};
|
|
274
|
-
return __assign.apply(this, arguments);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
var renderInline = function (h, id, tagName) {
|
|
281
|
-
return h(tagName ? tagName : 'div', {
|
|
282
|
-
attrs: { id: id }
|
|
283
|
-
});
|
|
284
|
-
};
|
|
285
|
-
var renderIframe = function (h, id) {
|
|
286
|
-
return h('textarea', {
|
|
287
|
-
attrs: { id: id },
|
|
288
|
-
style: { visibility: 'hidden' }
|
|
289
|
-
});
|
|
290
|
-
};
|
|
291
|
-
var initialise = function (ctx) { return function () {
|
|
292
|
-
var finalInit = __assign(__assign({}, ctx.$props.init), { readonly: ctx.$props.disabled, selector: "#" + ctx.elementId, plugins: mergePlugins(ctx.$props.init && ctx.$props.init.plugins, ctx.$props.plugins), toolbar: ctx.$props.toolbar || (ctx.$props.init && ctx.$props.init.toolbar), inline: ctx.inlineEditor, setup: function (editor) {
|
|
293
|
-
ctx.editor = editor;
|
|
294
|
-
editor.on('init', function (e) { return initEditor(e, ctx, editor); });
|
|
295
|
-
if (ctx.$props.init && typeof ctx.$props.init.setup === 'function') {
|
|
296
|
-
ctx.$props.init.setup(editor);
|
|
297
|
-
}
|
|
298
|
-
} });
|
|
299
|
-
if (isTextarea(ctx.element)) {
|
|
300
|
-
ctx.element.style.visibility = '';
|
|
301
|
-
ctx.element.style.display = '';
|
|
302
|
-
}
|
|
303
|
-
Object(TinyMCE["a" /* getTinymce */])().init(finalInit);
|
|
304
|
-
}; };
|
|
305
|
-
var Editor = {
|
|
306
|
-
props: editorProps,
|
|
307
|
-
created: function () {
|
|
308
|
-
this.elementId = this.$props.id || uuid('tiny-vue');
|
|
309
|
-
this.inlineEditor = (this.$props.init && this.$props.init.inline) || this.$props.inline;
|
|
310
|
-
this.initialized = false;
|
|
311
|
-
},
|
|
312
|
-
watch: {
|
|
313
|
-
disabled: function () {
|
|
314
|
-
this.editor.setMode(this.disabled ? 'readonly' : 'design');
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
mounted: function () {
|
|
318
|
-
this.element = this.$el;
|
|
319
|
-
if (Object(TinyMCE["a" /* getTinymce */])() !== null) {
|
|
320
|
-
initialise(this)();
|
|
321
|
-
}
|
|
322
|
-
else if (this.element && this.element.ownerDocument) {
|
|
323
|
-
var channel = this.$props.cloudChannel ? this.$props.cloudChannel : '5';
|
|
324
|
-
var apiKey = this.$props.apiKey ? this.$props.apiKey : 'no-api-key';
|
|
325
|
-
var scriptSrc = isNullOrUndefined(this.$props.tinymceScriptSrc) ?
|
|
326
|
-
"https://cdn.tiny.cloud/1/" + apiKey + "/tinymce/" + channel + "/tinymce.min.js" :
|
|
327
|
-
this.$props.tinymceScriptSrc;
|
|
328
|
-
ScriptLoader.load(this.element.ownerDocument, scriptSrc, initialise(this));
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
beforeDestroy: function () {
|
|
332
|
-
if (Object(TinyMCE["a" /* getTinymce */])() !== null) {
|
|
333
|
-
Object(TinyMCE["a" /* getTinymce */])().remove(this.editor);
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
deactivated: function () {
|
|
337
|
-
var _a;
|
|
338
|
-
if (!this.inlineEditor) {
|
|
339
|
-
this.cache = this.editor.getContent();
|
|
340
|
-
(_a = Object(TinyMCE["a" /* getTinymce */])()) === null || _a === void 0 ? void 0 : _a.remove(this.editor);
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
activated: function () {
|
|
344
|
-
if (!this.inlineEditor && this.initialized) {
|
|
345
|
-
initialise(this)();
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
render: function (h) {
|
|
349
|
-
return this.inlineEditor ? renderInline(h, this.elementId, this.$props.tagName) : renderIframe(h, this.elementId);
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
// CONCATENATED MODULE: ./node_modules/@tinymce/tinymce-vue/lib/es2015/main/ts/index.js
|
|
354
|
-
/**
|
|
355
|
-
* Copyright (c) 2018-present, Ephox, Inc.
|
|
356
|
-
*
|
|
357
|
-
* This source code is licensed under the Apache 2 license found in the
|
|
358
|
-
* LICENSE file in the root directory of this source tree.
|
|
359
|
-
*
|
|
360
|
-
*/
|
|
361
|
-
|
|
362
|
-
/* harmony default export */ var ts = __webpack_exports__["default"] = (Editor);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
/***/ })
|
|
366
|
-
|
|
367
|
-
}]);
|
|
368
|
-
//# sourceMappingURL=super-ui.common.1.js.map
|