diff --git a/.babelrc b/.babelrc new file mode 100755 index 000000000..25c76fff5 --- /dev/null +++ b/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": ["env", "stage-3"], + "plugins": ["transform-runtime"], + "comments": false +} diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 000000000..f524365f5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.eslintignore b/.eslintignore new file mode 100755 index 000000000..3c756c4b5 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +src/vendors +src/libs/table2excel.js +build +src/views/my-components/text-editor/tinymce \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100755 index 000000000..bc662a490 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "extends": "standard", + "installedESLint": true, + "root": true, + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "env": { + "browser": true, + "node": true + }, + "plugins": [ "html", "standard" ], + "rules": { + "indent": ["error", 4, { "SwitchCase": 1 }], + "quotes": ["error", "single"], + "semi": ["error", "always"], + "no-console": ["error"], + "no-empty": 2, + "no-eq-null": 2, + "no-new": 0, + "no-fallthrough": 0, + "no-unreachable": 0 + } +} diff --git a/.gitignore b/.gitignore new file mode 100755 index 000000000..dcf23d344 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +npm-debug.log +node_modules +.project +.vscode +.history +.DS_Store +\.settings/ +build/env.js +dist \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100755 index 000000000..9edf757bc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "6" +script: + - npm run test diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md new file mode 100755 index 000000000..89f52dae4 --- /dev/null +++ b/README.md @@ -0,0 +1,192 @@ +
+
+
+
+
+
+
+
+
iView-admin更新到了' + version + '了,去看看有哪些变化吧
前往github查看' + }); + } + }); +}; + +export default util; diff --git a/src/locale/index.js b/src/locale/index.js new file mode 100644 index 000000000..c6faabbef --- /dev/null +++ b/src/locale/index.js @@ -0,0 +1,21 @@ +import Vue from 'vue'; +import Locales from './locale'; +import zhLocale from 'iview/src/locale/lang/zh-CN'; +import enLocale from 'iview/src/locale/lang/en-US'; +import zhTLocale from 'iview/src/locale/lang/zh-TW'; + +// 自动设置语言 +const navLang = navigator.language; +const localLang = (navLang === 'zh-CN' || navLang === 'en-US') ? navLang : false; +const lang = window.localStorage.lang || localLang || 'zh-CN'; + +Vue.config.lang = lang; + +// 多语言配置 +const locales = Locales; +const mergeZH = Object.assign(zhLocale, locales['zh-CN']); +const mergeEN = Object.assign(enLocale, locales['en-US']); +const mergeTW = Object.assign(zhTLocale, locales['zh-TW']); +Vue.locale('zh-CN', mergeZH); +Vue.locale('en-US', mergeEN); +Vue.locale('zh-TW', mergeTW); diff --git a/src/locale/locale.js b/src/locale/locale.js new file mode 100755 index 000000000..529ae0092 --- /dev/null +++ b/src/locale/locale.js @@ -0,0 +1,50 @@ +export default { + 'zh-CN': { + home: '首页', + switchLangTitle: '切换语言', + international: '多语言切换', + iviewComponentTitle: 'iview组件多语言切换', + tip: '注:iview-admin只是为了示范如何实现多语言切换,所以只对当前页做了翻译。', + intro: 'iview目前支持15种语言,只要你看得到的iview组件出现iview内置文字的地方都会根据你设置的语言类型自动切换对应的语言。', + placeholderText: '请输入文字...', + placeholderDate: '选择日期', + name: '姓名', + company: '公司', + btnText: '点击查看模态框', + modalText: '在这里你可以看到iview模态框默认的确定和取消按钮会切换语言', + poptip: '国际化的气泡提示', + showPoptipText: '点击显示气泡提示' + }, + 'zh-TW': { + home: '首頁', + switchLangTitle: '切換語言', + international: '多語言切換', + iviewComponentTitle: 'iview組件多語言切換', + tip: '注:iview-admin只是為了示範如何實現多語言切換,所以只對當前頁做了翻譯。', + intro: 'iview目前支持15種語言,只要你看得到的iview組件出現iview內置文字的地方都會根據你設置的語言類型自動切換對應的語言。', + placeholderText: '請輸入文字...', + placeholderDate: '選擇日期', + name: '姓名', + company: '公司', + btnText: '點擊查看模態框', + modalText: '在這裡你可以看到iview模態框默認的確定和取消按鈕會切換語言', + poptip: '國際化的氣泡提示', + showPoptipText: '點擊顯示氣泡提示' + }, + 'en-US': { + home: 'home', + switchLangTitle: 'Switch Lang', + international: 'Switch Lang', + tip: 'Note: iview-admin just to demonstrate how to achieve multi-language switching, so only the current page to do the translation.', + iviewComponentTitle: 'The effect on the iview', + intro: 'iview currently supports 15 languages, as long as you see the iview component where the text will be based on your language type automatically set the corresponding language.', + placeholderText: 'please enter text...', + placeholderDate: 'Select Date', + name: 'name', + company: 'company', + btnText: 'Click to show modal', + modalText: 'Here you can see the iview modal box by default to the OK and Cancel buttons that will switch the language', + poptip: 'international poptip', + showPoptipText: 'Click to show poptip' + } +}; diff --git a/src/main.js b/src/main.js new file mode 100755 index 000000000..2022480f0 --- /dev/null +++ b/src/main.js @@ -0,0 +1,42 @@ +import Vue from 'vue'; +import iView from 'iview'; +import {router} from './router/index'; +import {appRouter} from './router/router'; +import store from './store'; +import App from './app.vue'; +import '@/locale'; +import 'iview/dist/styles/iview.css'; +import VueI18n from 'vue-i18n'; +import util from '@/libs/util'; + +Vue.use(VueI18n); +Vue.use(iView); + +new Vue({ + el: '#app', + router: router, + store: store, + render: h => h(App), + data: { + currentPageName: '' + }, + mounted () { + this.currentPageName = this.$route.name; + this.$store.commit('initCachepage'); + // 权限菜单过滤相关 + this.$store.commit('updateMenulist'); + // iview-admin检查更新 + util.checkUpdate(this); + }, + created () { + let tagsList = []; + appRouter.map((item) => { + if (item.children.length <= 1) { + tagsList.push(item.children[0]); + } else { + tagsList.push(...item.children); + } + }); + this.$store.commit('setTagsList', tagsList); + } +}); diff --git a/src/router/index.js b/src/router/index.js new file mode 100644 index 000000000..0d85537cc --- /dev/null +++ b/src/router/index.js @@ -0,0 +1,59 @@ +import Vue from 'vue'; +import iView from 'iview'; +import Util from '../libs/util'; +import VueRouter from 'vue-router'; +import Cookies from 'js-cookie'; +import {routers, otherRouter, appRouter} from './router'; + +Vue.use(VueRouter); + +// 路由配置 +const RouterConfig = { + // mode: 'history', + routes: routers +}; + +export const router = new VueRouter(RouterConfig); + +router.beforeEach((to, from, next) => { + iView.LoadingBar.start(); + Util.title(to.meta.title); + if (Cookies.get('locking') === '1' && to.name !== 'locking') { // 判断当前是否是锁定状态 + next(false); + router.replace({ + name: 'locking' + }); + } else if (Cookies.get('locking') === '0' && to.name === 'locking') { + next(false); + } else { + if (!Cookies.get('user') && to.name !== 'login') { // 判断是否已经登录且前往的页面不是登录页 + next({ + name: 'login' + }); + } else if (Cookies.get('user') && to.name === 'login') { // 判断是否已经登录且前往的是登录页 + Util.title(); + next({ + name: 'home_index' + }); + } else { + if (Util.getRouterObjByName([otherRouter, ...appRouter], to.name).access !== undefined) { // 判断用户是否有权限访问当前页 + if (Util.getRouterObjByName([otherRouter, ...appRouter], to.name).access === parseInt(Cookies.get('access'))) { + Util.toDefaultPage([otherRouter, ...appRouter], to.name, router, next); // 如果在地址栏输入的是一级菜单则默认打开其第一个二级菜单的页面 + } else { + router.replace({ + name: 'error_403' + }); + next(); + } + } else { + Util.toDefaultPage([otherRouter, ...appRouter], to.name, router, next); + } + } + } +}); + +router.afterEach((to) => { + Util.openNewPage(router.app, to.name, to.params, to.query); + iView.LoadingBar.finish(); + window.scrollTo(0, 0); +}); diff --git a/src/router/router.js b/src/router/router.js new file mode 100755 index 000000000..39b2bce93 --- /dev/null +++ b/src/router/router.js @@ -0,0 +1,235 @@ +import Main from '@/views/Main.vue'; + +// 不作为Main组件的子页面展示的页面单独写,如下 +export const loginRouter = { + path: '/login', + name: 'login', + meta: { + title: 'Login - 登录' + }, + component: resolve => { require(['@/views/login.vue'], resolve); } +}; + +export const page404 = { + path: '/*', + name: 'error-404', + meta: { + title: '404-页面不存在' + }, + component: resolve => { require(['@/views/error-page/404.vue'], resolve); } +}; + +export const page403 = { + path: '/403', + meta: { + title: '403-权限不足' + }, + name: 'error-403', + component: resolve => { require(['@//views/error-page/403.vue'], resolve); } +}; + +export const page500 = { + path: '/500', + meta: { + title: '500-服务端错误' + }, + name: 'error-500', + component: resolve => { require(['@/views/error-page/500.vue'], resolve); } +}; + +export const preview = { + path: '/preview', + name: 'preview', + component: resolve => { require(['@/views/form/article-publish/preview.vue'], resolve); } +}; + +export const locking = { + path: '/locking', + name: 'locking', + component: resolve => { require(['@/views/main-components/lockscreen/components/locking-page.vue'], resolve); } +}; + +// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里 +export const otherRouter = { + path: '/', + name: 'otherRouter', + component: Main, + children: [ + { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: resolve => { require(['@/views/home/home.vue'], resolve); } }, + { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: resolve => { require(['@/views/own-space/own-space.vue'], resolve); } }, + { path: 'order/:order_id', title: '订单详情', name: 'order_info', component: resolve => { require(['@/views/advanced-router/component/order-info.vue'], resolve); } }, // 用于展示动态路由 + { path: 'shopping', title: '购物详情', name: 'shopping', component: resolve => { require(['@/views/advanced-router/component/shopping-info.vue'], resolve); } }, // 用于展示带参路由 + { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['@/views/message/message.vue'], resolve); } } + ] +}; + +// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里 +export const appRouter = [ + { + path: '/access', + icon: 'key', + name: 'access', + title: '权限管理', + component: Main, + children: [ + { path: 'index', title: '权限管理', name: 'access_index', component: resolve => { require(['@/views/access/access.vue'], resolve); } } + ] + }, + { + path: '/access-test', + icon: 'lock-combination', + title: '权限测试页', + name: 'accesstest', + access: 0, + component: Main, + children: [ + { path: 'index', title: '权限测试页', name: 'accesstest_index' } + ] + }, + { + path: '/international', + icon: 'earth', + title: {i18n: 'international'}, + name: 'international', + component: Main, + children: [ + { path: 'index', title: {i18n: 'international'}, name: 'international_index', component: resolve => { require(['@/views/international/international.vue'], resolve); } } + ] + }, + { + path: '/component', + icon: 'social-buffer', + name: 'component', + title: '组件', + component: Main, + children: [ + { + path: 'text-editor', + icon: 'compose', + name: 'text-editor', + title: '富文本编辑器', + component: resolve => { require(['@/views/my-components/text-editor/text-editor.vue'], resolve); } + }, + { + path: 'md-editor', + icon: 'pound', + name: 'md-editor', + title: 'Markdown编辑器', + component: resolve => { require(['@/views/my-components/markdown-editor/markdown-editor.vue'], resolve); } + }, + { + path: 'image-editor', + icon: 'crop', + name: 'image-editor', + title: '图片预览编辑', + component: resolve => { require(['@/views/my-components/image-editor/image-editor.vue'], resolve); } + }, + { + path: 'draggable-list', + icon: 'arrow-move', + name: 'draggable-list', + title: '可拖拽列表', + component: resolve => { require(['@/views/my-components/draggable-list/draggable-list.vue'], resolve); } + }, + { + path: 'area-linkage', + icon: 'ios-more', + name: 'area-linkage', + title: '城市级联', + component: resolve => { require(['@/views/my-components/area-linkage/area-linkage.vue'], resolve); } + }, + { + path: 'file-upload', + icon: 'android-upload', + name: 'file-upload', + title: '文件上传', + component: resolve => { require(['@/views/my-components/file-upload/file-upload.vue'], resolve); } + }, + { + path: 'count-to', + icon: 'arrow-graph-up-right', + name: 'count-to', + title: '数字渐变', + component: resolve => { require(['@/views/my-components/count-to/count-to.vue'], resolve); } + } + // { + // path: 'clipboard-page', + // icon: 'clipboard', + // name: 'clipboard-page', + // title: '一键复制', + // component: resolve => { require(['@/views/my-components/clipboard/clipboard.vue'], resolve); } + // } + ] + }, + { + path: '/form', + icon: 'android-checkbox', + name: 'form', + title: '表单编辑', + component: Main, + children: [ + { path: 'artical-publish', title: '文章发布', name: 'artical-publish', icon: 'compose', component: resolve => { require(['@/views/form/article-publish/article-publish.vue'], resolve); } }, + { path: 'workflow', title: '工作流', name: 'workflow', icon: 'arrow-swap', component: resolve => { require(['@/views/form/work-flow/work-flow.vue'], resolve); } } + + ] + }, + // { + // path: '/charts', + // icon: 'ios-analytics', + // name: 'charts', + // title: '图表', + // component: Main, + // children: [ + // { path: 'pie', title: '饼状图', name: 'pie', icon: 'ios-pie', component: resolve => { require('@/views/access/access.vue') }, + // { path: 'histogram', title: '柱状图', name: 'histogram', icon: 'stats-bars', component: resolve => { require('@/views/access/access.vue') } + + // ] + // }, + { + path: '/tables', + icon: 'ios-grid-view', + name: 'tables', + title: '表格', + component: Main, + children: [ + { path: 'dragableTable', title: '可拖拽排序', name: 'dragable-table', icon: 'arrow-move', component: resolve => { require(['@/views/tables/dragable-table.vue'], resolve); } }, + { path: 'editableTable', title: '可编辑表格', name: 'editable-table', icon: 'edit', component: resolve => { require(['@/views/tables/editable-table.vue'], resolve); } }, + { path: 'searchableTable', title: '可搜索表格', name: 'searchable-table', icon: 'search', component: resolve => { require(['@/views/tables/searchable-table.vue'], resolve); } }, + { path: 'exportableTable', title: '表格导出数据', name: 'exportable-table', icon: 'code-download', component: resolve => { require(['@/views/tables/exportable-table.vue'], resolve); } }, + { path: 'table2image', title: '表格转图片', name: 'table-to-image', icon: 'images', component: resolve => { require(['@/views/tables/table-to-image.vue'], resolve); } } + ] + }, + { + path: '/advanced-router', + icon: 'ios-infinite', + name: 'advanced-router', + title: '高级路由', + component: Main, + children: [ + { path: 'mutative-router', title: '动态路由', name: 'mutative-router', icon: 'link', component: resolve => { require(['@/views/advanced-router/mutative-router.vue'], resolve); } }, + { path: 'argument-page', title: '带参页面', name: 'argument-page', icon: 'android-send', component: resolve => { require(['@/views/advanced-router/argument-page.vue'], resolve); } } + ] + }, + { + path: '/error-page', + icon: 'android-sad', + title: '错误页面', + name: 'errorpage', + component: Main, + children: [ + { path: 'index', title: '错误页面', name: 'errorpage_index', component: resolve => { require(['@/views/error-page/error-page.vue'], resolve); } } + ] + } +]; + +// 所有上面定义的路由都要写在下面的routers里 +export const routers = [ + loginRouter, + otherRouter, + preview, + locking, + ...appRouter, + page500, + page403, + page404 +]; diff --git a/src/store/index.js b/src/store/index.js new file mode 100644 index 000000000..a73fc4990 --- /dev/null +++ b/src/store/index.js @@ -0,0 +1,32 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; +import Util from '@/libs/util'; + +import app from './modules/app'; +import user from './modules/user'; + +Vue.use(Vuex); + +const store = new Vuex.Store({ + state: { + dontCache: ['text-editor', 'artical-publish'] // 在这里定义你不想要缓存的页面的name属性值(参见路由配置router.js) + }, + mutations: { + increateTag (state, tagObj) { + if (!Util.oneOf(tagObj.name, state.dontCache)) { + state.app.cachePage.push(tagObj.name); + localStorage.cachePage = JSON.stringify(state.app.cachePage); + } + state.app.pageOpenedList.push(tagObj); + } + }, + actions: { + + }, + modules: { + app, + user + } +}); + +export default store; diff --git a/src/store/modules/app.js b/src/store/modules/app.js new file mode 100644 index 000000000..b64b16212 --- /dev/null +++ b/src/store/modules/app.js @@ -0,0 +1,184 @@ +import {otherRouter, appRouter} from '@/router/router'; +import Util from '@/libs/util'; +import Cookies from 'js-cookie'; +import Vue from 'vue'; + +const app = { + state: { + cachePage: [], + lang: '', + isFullScreen: false, + openedSubmenuArr: [], // 要展开的菜单数组 + menuTheme: 'dark', // 主题 + themeColor: '', + pageOpenedList: [{ + title: '首页', + path: '', + name: 'home_index' + }], + currentPageName: '', + currentPath: [ + { + title: '首页', + path: '', + name: 'home_index' + } + ], // 面包屑数组 + menuList: [], + routers: [ + otherRouter, + ...appRouter + ], + tagsList: [...otherRouter.children], + messageCount: 0 + }, + mutations: { + setTagsList (state, list) { + state.tagsList.push(...list); + }, + updateMenulist (state) { + let accessCode = parseInt(Cookies.get('access')); + let menuList = []; + appRouter.forEach((item, index) => { + if (item.access !== undefined) { + if (Util.showThisRoute(item.access, accessCode)) { + if (item.children.length === 1) { + menuList.push(item); + } else { + let len = menuList.push(item); + let childrenArr = []; + childrenArr = item.children.filter(child => { + if (child.access !== undefined) { + if (child.access === accessCode) { + return child; + } + } else { + return child; + } + }); + menuList[len - 1].children = childrenArr; + } + } + } else { + if (item.children.length === 1) { + menuList.push(item); + } else { + let len = menuList.push(item); + let childrenArr = []; + childrenArr = item.children.filter(child => { + if (child.access !== undefined) { + if (Util.showThisRoute(child.access, accessCode)) { + return child; + } + } else { + return child; + } + }); + let handledItem = JSON.parse(JSON.stringify(menuList[len - 1])); + handledItem.children = childrenArr; + menuList.splice(len - 1, 1, handledItem); + } + } + }); + state.menuList = menuList; + }, + changeMenuTheme (state, theme) { + state.menuTheme = theme; + }, + changeMainTheme (state, mainTheme) { + state.themeColor = mainTheme; + }, + addOpenSubmenu (state, name) { + let hasThisName = false; + let isEmpty = false; + if (name.length === 0) { + isEmpty = true; + } + if (state.openedSubmenuArr.indexOf(name) > -1) { + hasThisName = true; + } + if (!hasThisName && !isEmpty) { + state.openedSubmenuArr.push(name); + } + }, + closePage (state, name) { + state.cachePage.forEach((item, index) => { + if (item === name) { + state.cachePage.splice(index, 1); + } + }); + }, + initCachepage (state) { + if (localStorage.cachePage) { + state.cachePage = JSON.parse(localStorage.cachePage); + } + }, + removeTag (state, name) { + state.pageOpenedList.map((item, index) => { + if (item.name === name) { + state.pageOpenedList.splice(index, 1); + } + }); + }, + pageOpenedList (state, get) { + let openedPage = state.pageOpenedList[get.index]; + if (get.argu) { + openedPage.argu = get.argu; + } + if (get.query) { + openedPage.query = get.query; + } + state.pageOpenedList.splice(get.index, 1, openedPage); + localStorage.pageOpenedList = JSON.stringify(state.pageOpenedList); + }, + clearAllTags (state) { + state.pageOpenedList.splice(1); + state.cachePage.length = 0; + localStorage.pageOpenedList = JSON.stringify(state.pageOpenedList); + }, + clearOtherTags (state, vm) { + let currentName = vm.$route.name; + let currentIndex = 0; + state.pageOpenedList.forEach((item, index) => { + if (item.name === currentName) { + currentIndex = index; + } + }); + if (currentIndex === 0) { + state.pageOpenedList.splice(1); + } else { + state.pageOpenedList.splice(currentIndex + 1); + state.pageOpenedList.splice(1, currentIndex - 1); + } + let newCachepage = state.cachePage.filter(item => { + return item === currentName; + }); + state.cachePage = newCachepage; + localStorage.pageOpenedList = JSON.stringify(state.pageOpenedList); + }, + setOpenedList (state) { + state.pageOpenedList = localStorage.pageOpenedList ? JSON.parse(localStorage.pageOpenedList) : [otherRouter.children[0]]; + }, + setCurrentPath (state, pathArr) { + state.currentPath = pathArr; + }, + setCurrentPageName (state, name) { + state.currentPageName = name; + }, + setAvator (state, path) { + localStorage.avatorImgPath = path; + }, + switchLang (state, lang) { + state.lang = lang; + Vue.config.lang = lang; + }, + clearOpenedSubmenu (state) { + state.openedSubmenuArr.length = 0; + }, + setMessageCount (state, count) { + state.messageCount = count; + } + } +}; + +export default app; diff --git a/src/store/modules/user.js b/src/store/modules/user.js new file mode 100644 index 000000000..c3dc8eb63 --- /dev/null +++ b/src/store/modules/user.js @@ -0,0 +1,26 @@ +import Cookies from 'js-cookie'; + +const user = { + state: {}, + mutations: { + logout (state, vm) { + Cookies.remove('user'); + Cookies.remove('password'); + Cookies.remove('access'); + // 恢复默认样式 + let themeLink = document.querySelector('link[name="theme"]'); + themeLink.setAttribute('href', ''); + // 清空打开的页面等数据,但是保存主题数据 + let theme = ''; + if (localStorage.theme) { + theme = localStorage.theme; + } + localStorage.clear(); + if (theme) { + localStorage.theme = theme; + } + } + } +}; + +export default user; diff --git a/src/styles/common.less b/src/styles/common.less new file mode 100755 index 000000000..575b58054 --- /dev/null +++ b/src/styles/common.less @@ -0,0 +1,64 @@ +.margin-top-8{ + margin-top: 8px; +} +.margin-top-10{ + margin-top: 10px; +} +.margin-top-20{ + margin-top: 20px; +} +.margin-left-10{ + margin-left: 10px; +} +.margin-bottom-10{ + margin-bottom: 10px; +} +.margin-bottom-100{ + margin-bottom: 100px; +} +.margin-right-10{ + margin-right: 10px; +} +.padding-left-6{ + padding-left: 6px; +} +.padding-left-8{ + padding-left: 5px; +} +.padding-left-10{ + padding-left: 10px; +} +.padding-left-20{ + padding-left: 20px; +} +.height-100{ + height: 100%; +} +.height-120px{ + height: 100px; +} +.height-200px{ + height: 200px; +} +.height-492px{ + height: 492px; +} +.height-460px{ + height: 460px; +} +.line-gray{ + height: 0; + border-bottom: 2px solid #dcdcdc; +} +.notwrap{ + word-break:keep-all; + white-space:nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.padding-left-5{ + padding-left: 10px; +} +[v-cloak]{ + display: none; +} \ No newline at end of file diff --git a/src/styles/fonts/ionicons.eot b/src/styles/fonts/ionicons.eot new file mode 100755 index 000000000..92a3f20a3 Binary files /dev/null and b/src/styles/fonts/ionicons.eot differ diff --git a/src/styles/fonts/ionicons.svg b/src/styles/fonts/ionicons.svg new file mode 100755 index 000000000..49fc8f367 --- /dev/null +++ b/src/styles/fonts/ionicons.svg @@ -0,0 +1,2230 @@ + + + + diff --git a/src/styles/fonts/ionicons.ttf b/src/styles/fonts/ionicons.ttf new file mode 100755 index 000000000..c4e463248 Binary files /dev/null and b/src/styles/fonts/ionicons.ttf differ diff --git a/src/styles/fonts/ionicons.woff b/src/styles/fonts/ionicons.woff new file mode 100755 index 000000000..5f3a14e0a Binary files /dev/null and b/src/styles/fonts/ionicons.woff differ diff --git a/src/styles/loading.less b/src/styles/loading.less new file mode 100644 index 000000000..b4aad5b6b --- /dev/null +++ b/src/styles/loading.less @@ -0,0 +1,8 @@ +.demo-spin-icon-load{ + animation: ani-demo-spin 1s linear infinite; +} +@keyframes ani-demo-spin { + from { transform: rotate(0deg);} + 50% { transform: rotate(180deg);} + to { transform: rotate(360deg);} +} \ No newline at end of file diff --git a/src/styles/login_bg.jpg b/src/styles/login_bg.jpg new file mode 100644 index 000000000..b6b48fd73 Binary files /dev/null and b/src/styles/login_bg.jpg differ diff --git a/src/template/index.ejs b/src/template/index.ejs new file mode 100755 index 000000000..177d066df --- /dev/null +++ b/src/template/index.ejs @@ -0,0 +1,20 @@ + + + + +
+
当前用户权限值:{{ accessCode }}
+
+
您可以通过左侧的开关来切换当前用户的权限值,然后您可以观察左侧菜单栏的变化,如果当前用户的权限值是 0 ,则左侧菜单栏会显示’权限测试页‘这一项('权限测试页'只用于测试,点击不会跳转)。
+
+
+
虽然iview-admin支持打开带参数的页面,但是类似于这种需求,还是建议用iview的Modal或者使用表格直接在表格内展开数据
+ +iview官方示例表格
+
+
+
+
当访问的页面不存在时会跳转到404页面,您可以在浏览器地址栏中修改url为一个不存在的路径,体验一下效果
+
+
在当前登录用户不具有执行当前操作的权限时跳转到该页面,您可以在ajax请求方法中判断返回的状态码为403时跳转到该页面
+
+
当请求之后出现服务端错误时跳转到该页面,您可以在ajax请求方法中判断返回的状态码为500时跳转到该页面
+
+
+
+
+
+
+
+
+
+
{{ startVal }}{{ unit }}
+{{ introText }}
+{{ content }}
+super admin
+上次登录时间:
+上次登录地点:
+
+
+
+
+
+
+
+
{{ $t('tip') }}
+
+
{{ $t('intro') }}
+ +{{ $t('modalText') }}
+
+
输入任意用户名和密码即可
+解锁
+
+
+<al-selector v-model="resDefault" /> ++
+<al-cascader v-model="res1" /> ++
更多配置可参考iview-area组件官方文档:iview-area
+
+
+{{ res1 }} ++
+{{ resDefault }} ++
+ 一级 +
++ 二级 +
++ 三级 +
++ 四级 +
++ 禁用指定级别 +
++ 四级 +
++ 三级 +
++ 二级 +
++ 一级 +
++ 三种尺寸 +
++ 三种尺寸 +
++ 自定义显示格式 +
++ 可搜索 +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
点击或将文件拖拽到这里上传
+
+
+
预览裁剪之后的图片
+
+
x:{{ cropdata2.x }}
+y:{{ cropdata2.y }}
+width:{{ cropdata2.w }}
+heigh:{{ cropdata2.h }}
+deg:{{ cropdata2.deg }}
+scaleX:{{ cropdata2.scaleX }}
+scaleY:{{ cropdata2.scaleY }}
+
+
预览裁剪之后的图片
+]*>/gi, '[quote]'); + rep(/<\/blockquote>/gi, '[/quote]'); + rep(/
/gi, '\n'); + rep(/
/gi, '\n'); + rep(/
/gi, '\n'); + rep(//gi, ''); + rep(/<\/p>/gi, '\n'); + rep(/ |\u00a0/gi, ' '); + rep(/"/gi, '"'); + rep(/</gi, '<'); + rep(/>/gi, '>'); + rep(/&/gi, '&'); + + return s; + }; + + var bbcode2html = function (s) { + s = Tools.trim(s); + + var rep = function (re, str) { + s = s.replace(re, str); + }; + + // example: [b] to + rep(/\n/gi, '
'); + rep(/\[b\]/gi, ''); + rep(/\[\/b\]/gi, ''); + rep(/\[i\]/gi, ''); + rep(/\[\/i\]/gi, ''); + rep(/\[u\]/gi, ''); + rep(/\[\/u\]/gi, ''); + rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'); + rep(/\[url\](.*?)\[\/url\]/gi, '$1'); + rep(/\[img\](.*?)\[\/img\]/gi, ''); + rep(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'); + rep(/\[code\](.*?)\[\/code\]/gi, '$1 '); + rep(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '); + + return s; + }; + + return { + html2bbcode: html2bbcode, + bbcode2html: bbcode2html + }; + } +); +/** + * Plugin.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.bbcode.Plugin', + [ + 'tinymce.core.PluginManager', + 'tinymce.plugins.bbcode.core.Convert' + ], + function (PluginManager, Convert) { + PluginManager.add('bbcode', function () { + return { + init: function (editor) { + editor.on('beforeSetContent', function (e) { + e.content = Convert.bbcode2html(e.content); + }); + + editor.on('postProcess', function (e) { + if (e.set) { + e.content = Convert.bbcode2html(e.content); + } + + if (e.get) { + e.content = Convert.html2bbcode(e.content); + } + }); + } + }; + }); + + return function () { }; + } +); + dem('tinymce.plugins.bbcode.Plugin')(); +})(); diff --git a/src/views/my-components/text-editor/tinymce/plugins/bbcode/plugin.min.js b/src/views/my-components/text-editor/tinymce/plugins/bbcode/plugin.min.js new file mode 100644 index 000000000..a6e9daae6 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/bbcode/plugin.min.js @@ -0,0 +1 @@ +!(function () { var a = {}, b = function (b) { for (var c = a[b], e = c.deps, f = c.defn, g = e.length, h = new Array(g), i = 0; i < g; ++i)h[i] = d(e[i]); var j = f.apply(null, h); if (void 0 === j) throw 'module [' + b + '] returned undefined'; c.instance = j; }, c = function (b, c, d) { if (typeof b !== 'string') throw 'module id must be a string'; if (void 0 === c) throw 'no dependencies for ' + b; if (void 0 === d) throw 'no definition function for ' + b; a[b] = {deps: c, defn: d, instance: void 0}; }, d = function (c) { var d = a[c]; if (void 0 === d) throw 'module [' + c + '] was undefined'; return void 0 === d.instance && b(c), d.instance; }, e = function (a, b) { for (var c = a.length, e = new Array(c), f = 0; f < c; ++f)e[f] = d(a[f]); b.apply(null, e); }, f = {}; f.bolt = {module: {api: {define: c, require: e, demand: d}}}; var g = c, h = function (a, b) { g(a, [], function () { return b; }); }; h('3', tinymce.util.Tools.resolve), g('1', ['3'], function (a) { return a('tinymce.PluginManager'); }), g('4', ['3'], function (a) { return a('tinymce.util.Tools'); }), g('2', ['4'], function (a) { var b = function (b) { b = a.trim(b); var c = function (a, c) { b = b.replace(a, c); }; return c(/
(.*?)<\/a>/gi, '[url=$1]$2[/url]'), c(/ (.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'), c(/ (.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'), c(/ (.*?)<\/font>/gi, '[code][color=$1]$2[/color][/code]'), c(/ (.*?)<\/font>/gi, '[quote][color=$1]$2[/color][/quote]'), c(/(.*?)<\/span>/gi, '[color=$1]$2[/color]'), c(/ (.*?)<\/font>/gi, '[color=$1]$2[/color]'), c(/(.*?)<\/span>/gi, '[size=$1]$2[/size]'), c(/(.*?)<\/font>/gi, '$1'), c(/ /gi, '[img]$1[/img]'), c(/(.*?)<\/span>/gi, '[code]$1[/code]'), c(/(.*?)<\/span>/gi, '[quote]$1[/quote]'), c(/(.*?)<\/strong>/gi, '[code][b]$1[/b][/code]'), c(/(.*?)<\/strong>/gi, '[quote][b]$1[/b][/quote]'), c(/(.*?)<\/em>/gi, '[code][i]$1[/i][/code]'), c(/(.*?)<\/em>/gi, '[quote][i]$1[/i][/quote]'), c(/(.*?)<\/u>/gi, '[code][u]$1[/u][/code]'), c(/(.*?)<\/u>/gi, '[quote][u]$1[/u][/quote]'), c(/<\/(strong|b)>/gi, '[/b]'), c(/<(strong|b)>/gi, '[b]'), c(/<\/(em|i)>/gi, '[/i]'), c(/<(em|i)>/gi, '[i]'), c(/<\/u>/gi, '[/u]'), c(/(.*?)<\/span>/gi, '[u]$1[/u]'), c(//gi, '[u]'), c(/ ]*>/gi, '[quote]'), c(/<\/blockquote>/gi, '[/quote]'), c(/
/gi, '\n'), c(/
/gi, '\n'), c(/
/gi, '\n'), c(//gi, ''), c(/<\/p>/gi, '\n'), c(/ |\u00a0/gi, ' '), c(/"/gi, '"'), c(/</gi, '<'), c(/>/gi, '>'), c(/&/gi, '&'), b; }, c = function (b) { b = a.trim(b); var c = function (a, c) { b = b.replace(a, c); }; return c(/\n/gi, '
'), c(/\[b\]/gi, ''), c(/\[\/b\]/gi, ''), c(/\[i\]/gi, ''), c(/\[\/i\]/gi, ''), c(/\[u\]/gi, ''), c(/\[\/u\]/gi, ''), c(/\[url=([^\]]+)\](.*?)\[\/url\]/gi, '$2'), c(/\[url\](.*?)\[\/url\]/gi, '$1'), c(/\[img\](.*?)\[\/img\]/gi, ''), c(/\[color=(.*?)\](.*?)\[\/color\]/gi, '$2'), c(/\[code\](.*?)\[\/code\]/gi, '$1 '), c(/\[quote.*?\](.*?)\[\/quote\]/gi, '$1 '), b; }; return {html2bbcode: b, bbcode2html: c}; }), g('0', ['1', '2'], function (a, b) { return a.add('bbcode', function () { return {init: function (a) { a.on('beforeSetContent', function (a) { a.content = b.bbcode2html(a.content); }), a.on('postProcess', function (a) { a.set && (a.content = b.bbcode2html(a.content)), a.get && (a.content = b.html2bbcode(a.content)); }); }}; }), function () {}; }), d('0')(); }()); diff --git a/src/views/my-components/text-editor/tinymce/plugins/charmap/index.js b/src/views/my-components/text-editor/tinymce/plugins/charmap/index.js new file mode 100644 index 000000000..19b5054c0 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/charmap/index.js @@ -0,0 +1,7 @@ +// Exports the "charmap" plugin for usage with module loaders +// Usage: +// CommonJS: +// require('tinymce/plugins/charmap') +// ES2015: +// import 'tinymce/plugins/charmap' +require('./plugin.js'); diff --git a/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.js b/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.js new file mode 100644 index 000000000..e02fe7824 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.js @@ -0,0 +1,831 @@ +(function () { + var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + +// Used when there is no 'main' module. +// The name is probably (hopefully) unique so minification removes for releases. + var register_3795 = function (id) { + var module = dem(id); + var fragments = id.split('.'); + var target = Function('return this;')(); + for (var i = 0; i < fragments.length - 1; ++i) { + if (target[fragments[i]] === undefined) { target[fragments[i]] = {}; } + target = target[fragments[i]]; + } + target[fragments[fragments.length - 1]] = module; + }; + + var instantiate = function (id) { + var actual = defs[id]; + var dependencies = actual.deps; + var definition = actual.defn; + var len = dependencies.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(dependencies[i]); } + var defResult = definition.apply(null, instances); + if (defResult === undefined) { throw 'module [' + id + '] returned undefined'; } + actual.instance = defResult; + }; + + var def = function (id, dependencies, definition) { + if (typeof id !== 'string') { throw 'module id must be a string'; } else if (dependencies === undefined) { throw 'no dependencies for ' + id; } else if (definition === undefined) { throw 'no definition function for ' + id; } + defs[id] = { + deps: dependencies, + defn: definition, + instance: undefined + }; + }; + + var dem = function (id) { + var actual = defs[id]; + if (actual === undefined) { throw 'module [' + id + '] was undefined'; } else if (actual.instance === undefined) { instantiate(id); } + return actual.instance; + }; + + var req = function (ids, callback) { + var len = ids.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(ids[i]); } + callback.apply(null, instances); + }; + + var ephox = {}; + + ephox.bolt = { + module: { + api: { + define: def, + require: req, + demand: dem + } + } + }; + + var define = def; + var require = req; + var demand = dem; +// this helps with minification when using a lot of global references + var defineGlobal = function (id, ref) { + define(id, [], function () { return ref; }); + }; +/* jsc +["tinymce.plugins.charmap.Plugin","tinymce.core.PluginManager","tinymce.plugins.charmap.api.Api","tinymce.plugins.charmap.api.Commands","tinymce.plugins.charmap.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.charmap.core.Actions","tinymce.plugins.charmap.core.CharMap","tinymce.plugins.charmap.ui.Dialog","tinymce.plugins.charmap.api.Events","tinymce.core.util.Tools","tinymce.plugins.charmap.api.Settings","tinymce.plugins.charmap.ui.GridHtml"] +jsc */ + defineGlobal('global!tinymce.util.Tools.resolve', tinymce.util.Tools.resolve); +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.PluginManager', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.PluginManager'); + } +); + +/** + * Events.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.api.Events', + [ + ], + function () { + var fireInsertCustomChar = function (editor, chr) { + return editor.fire('insertCustomChar', { chr: chr }); + }; + + return { + fireInsertCustomChar: fireInsertCustomChar + }; + } +); + +/** + * Actions.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.core.Actions', + [ + 'tinymce.plugins.charmap.api.Events' + ], + function (Events) { + var insertChar = function (editor, chr) { + var evtChr = Events.fireInsertCustomChar(editor, chr).chr; + editor.execCommand('mceInsertContent', false, evtChr); + }; + + return { + insertChar: insertChar + }; + } +); +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.util.Tools', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.util.Tools'); + } +); + +/** + * Settings.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.api.Settings', + [ + ], + function () { + var getCharMap = function (editor) { + return editor.settings.charmap; + }; + + var getCharMapAppend = function (editor) { + return editor.settings.charmap_append; + }; + + return { + getCharMap: getCharMap, + getCharMapAppend: getCharMapAppend + }; + } +); +/** + * CharMap.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.core.CharMap', + [ + 'tinymce.core.util.Tools', + 'tinymce.plugins.charmap.api.Settings' + ], + function (Tools, Settings) { + var isArray = Tools.isArray; + + var getDefaultCharMap = function () { + return [ + ['160', 'no-break space'], + ['173', 'soft hyphen'], + ['34', 'quotation mark'], + // finance + ['162', 'cent sign'], + ['8364', 'euro sign'], + ['163', 'pound sign'], + ['165', 'yen sign'], + // signs + ['169', 'copyright sign'], + ['174', 'registered sign'], + ['8482', 'trade mark sign'], + ['8240', 'per mille sign'], + ['181', 'micro sign'], + ['183', 'middle dot'], + ['8226', 'bullet'], + ['8230', 'three dot leader'], + ['8242', 'minutes / feet'], + ['8243', 'seconds / inches'], + ['167', 'section sign'], + ['182', 'paragraph sign'], + ['223', 'sharp s / ess-zed'], + // quotations + ['8249', 'single left-pointing angle quotation mark'], + ['8250', 'single right-pointing angle quotation mark'], + ['171', 'left pointing guillemet'], + ['187', 'right pointing guillemet'], + ['8216', 'left single quotation mark'], + ['8217', 'right single quotation mark'], + ['8220', 'left double quotation mark'], + ['8221', 'right double quotation mark'], + ['8218', 'single low-9 quotation mark'], + ['8222', 'double low-9 quotation mark'], + ['60', 'less-than sign'], + ['62', 'greater-than sign'], + ['8804', 'less-than or equal to'], + ['8805', 'greater-than or equal to'], + ['8211', 'en dash'], + ['8212', 'em dash'], + ['175', 'macron'], + ['8254', 'overline'], + ['164', 'currency sign'], + ['166', 'broken bar'], + ['168', 'diaeresis'], + ['161', 'inverted exclamation mark'], + ['191', 'turned question mark'], + ['710', 'circumflex accent'], + ['732', 'small tilde'], + ['176', 'degree sign'], + ['8722', 'minus sign'], + ['177', 'plus-minus sign'], + ['247', 'division sign'], + ['8260', 'fraction slash'], + ['215', 'multiplication sign'], + ['185', 'superscript one'], + ['178', 'superscript two'], + ['179', 'superscript three'], + ['188', 'fraction one quarter'], + ['189', 'fraction one half'], + ['190', 'fraction three quarters'], + // math / logical + ['402', 'function / florin'], + ['8747', 'integral'], + ['8721', 'n-ary sumation'], + ['8734', 'infinity'], + ['8730', 'square root'], + ['8764', 'similar to'], + ['8773', 'approximately equal to'], + ['8776', 'almost equal to'], + ['8800', 'not equal to'], + ['8801', 'identical to'], + ['8712', 'element of'], + ['8713', 'not an element of'], + ['8715', 'contains as member'], + ['8719', 'n-ary product'], + ['8743', 'logical and'], + ['8744', 'logical or'], + ['172', 'not sign'], + ['8745', 'intersection'], + ['8746', 'union'], + ['8706', 'partial differential'], + ['8704', 'for all'], + ['8707', 'there exists'], + ['8709', 'diameter'], + ['8711', 'backward difference'], + ['8727', 'asterisk operator'], + ['8733', 'proportional to'], + ['8736', 'angle'], + // undefined + ['180', 'acute accent'], + ['184', 'cedilla'], + ['170', 'feminine ordinal indicator'], + ['186', 'masculine ordinal indicator'], + ['8224', 'dagger'], + ['8225', 'double dagger'], + // alphabetical special chars + ['192', 'A - grave'], + ['193', 'A - acute'], + ['194', 'A - circumflex'], + ['195', 'A - tilde'], + ['196', 'A - diaeresis'], + ['197', 'A - ring above'], + ['256', 'A - macron'], + ['198', 'ligature AE'], + ['199', 'C - cedilla'], + ['200', 'E - grave'], + ['201', 'E - acute'], + ['202', 'E - circumflex'], + ['203', 'E - diaeresis'], + ['274', 'E - macron'], + ['204', 'I - grave'], + ['205', 'I - acute'], + ['206', 'I - circumflex'], + ['207', 'I - diaeresis'], + ['298', 'I - macron'], + ['208', 'ETH'], + ['209', 'N - tilde'], + ['210', 'O - grave'], + ['211', 'O - acute'], + ['212', 'O - circumflex'], + ['213', 'O - tilde'], + ['214', 'O - diaeresis'], + ['216', 'O - slash'], + ['332', 'O - macron'], + ['338', 'ligature OE'], + ['352', 'S - caron'], + ['217', 'U - grave'], + ['218', 'U - acute'], + ['219', 'U - circumflex'], + ['220', 'U - diaeresis'], + ['362', 'U - macron'], + ['221', 'Y - acute'], + ['376', 'Y - diaeresis'], + ['562', 'Y - macron'], + ['222', 'THORN'], + ['224', 'a - grave'], + ['225', 'a - acute'], + ['226', 'a - circumflex'], + ['227', 'a - tilde'], + ['228', 'a - diaeresis'], + ['229', 'a - ring above'], + ['257', 'a - macron'], + ['230', 'ligature ae'], + ['231', 'c - cedilla'], + ['232', 'e - grave'], + ['233', 'e - acute'], + ['234', 'e - circumflex'], + ['235', 'e - diaeresis'], + ['275', 'e - macron'], + ['236', 'i - grave'], + ['237', 'i - acute'], + ['238', 'i - circumflex'], + ['239', 'i - diaeresis'], + ['299', 'i - macron'], + ['240', 'eth'], + ['241', 'n - tilde'], + ['242', 'o - grave'], + ['243', 'o - acute'], + ['244', 'o - circumflex'], + ['245', 'o - tilde'], + ['246', 'o - diaeresis'], + ['248', 'o slash'], + ['333', 'o macron'], + ['339', 'ligature oe'], + ['353', 's - caron'], + ['249', 'u - grave'], + ['250', 'u - acute'], + ['251', 'u - circumflex'], + ['252', 'u - diaeresis'], + ['363', 'u - macron'], + ['253', 'y - acute'], + ['254', 'thorn'], + ['255', 'y - diaeresis'], + ['563', 'y - macron'], + ['913', 'Alpha'], + ['914', 'Beta'], + ['915', 'Gamma'], + ['916', 'Delta'], + ['917', 'Epsilon'], + ['918', 'Zeta'], + ['919', 'Eta'], + ['920', 'Theta'], + ['921', 'Iota'], + ['922', 'Kappa'], + ['923', 'Lambda'], + ['924', 'Mu'], + ['925', 'Nu'], + ['926', 'Xi'], + ['927', 'Omicron'], + ['928', 'Pi'], + ['929', 'Rho'], + ['931', 'Sigma'], + ['932', 'Tau'], + ['933', 'Upsilon'], + ['934', 'Phi'], + ['935', 'Chi'], + ['936', 'Psi'], + ['937', 'Omega'], + ['945', 'alpha'], + ['946', 'beta'], + ['947', 'gamma'], + ['948', 'delta'], + ['949', 'epsilon'], + ['950', 'zeta'], + ['951', 'eta'], + ['952', 'theta'], + ['953', 'iota'], + ['954', 'kappa'], + ['955', 'lambda'], + ['956', 'mu'], + ['957', 'nu'], + ['958', 'xi'], + ['959', 'omicron'], + ['960', 'pi'], + ['961', 'rho'], + ['962', 'final sigma'], + ['963', 'sigma'], + ['964', 'tau'], + ['965', 'upsilon'], + ['966', 'phi'], + ['967', 'chi'], + ['968', 'psi'], + ['969', 'omega'], + // symbols + ['8501', 'alef symbol'], + ['982', 'pi symbol'], + ['8476', 'real part symbol'], + ['978', 'upsilon - hook symbol'], + ['8472', 'Weierstrass p'], + ['8465', 'imaginary part'], + // arrows + ['8592', 'leftwards arrow'], + ['8593', 'upwards arrow'], + ['8594', 'rightwards arrow'], + ['8595', 'downwards arrow'], + ['8596', 'left right arrow'], + ['8629', 'carriage return'], + ['8656', 'leftwards double arrow'], + ['8657', 'upwards double arrow'], + ['8658', 'rightwards double arrow'], + ['8659', 'downwards double arrow'], + ['8660', 'left right double arrow'], + ['8756', 'therefore'], + ['8834', 'subset of'], + ['8835', 'superset of'], + ['8836', 'not a subset of'], + ['8838', 'subset of or equal to'], + ['8839', 'superset of or equal to'], + ['8853', 'circled plus'], + ['8855', 'circled times'], + ['8869', 'perpendicular'], + ['8901', 'dot operator'], + ['8968', 'left ceiling'], + ['8969', 'right ceiling'], + ['8970', 'left floor'], + ['8971', 'right floor'], + ['9001', 'left-pointing angle bracket'], + ['9002', 'right-pointing angle bracket'], + ['9674', 'lozenge'], + ['9824', 'black spade suit'], + ['9827', 'black club suit'], + ['9829', 'black heart suit'], + ['9830', 'black diamond suit'], + ['8194', 'en space'], + ['8195', 'em space'], + ['8201', 'thin space'], + ['8204', 'zero width non-joiner'], + ['8205', 'zero width joiner'], + ['8206', 'left-to-right mark'], + ['8207', 'right-to-left mark'] + ]; + }; + + var charmapFilter = function (charmap) { + return Tools.grep(charmap, function (item) { + return isArray(item) && item.length === 2; + }); + }; + + var getCharsFromSetting = function (settingValue) { + if (isArray(settingValue)) { + return [].concat(charmapFilter(settingValue)); + } + + if (typeof settingValue === 'function') { + return settingValue(); + } + + return []; + }; + + var extendCharMap = function (editor, charmap) { + var userCharMap = Settings.getCharMap(editor); + if (userCharMap) { + charmap = getCharsFromSetting(userCharMap); + } + + var userCharMapAppend = Settings.getCharMapAppend(editor); + if (userCharMapAppend) { + return [].concat(charmap).concat(getCharsFromSetting(userCharMapAppend)); + } + + return charmap; + }; + + var getCharMap = function (editor) { + return extendCharMap(editor, getDefaultCharMap()); + }; + + return { + getCharMap: getCharMap + }; + } +); +/** + * Api.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.api.Api', + [ + 'tinymce.plugins.charmap.core.Actions', + 'tinymce.plugins.charmap.core.CharMap' + ], + function (Actions, CharMap) { + var get = function (editor) { + var getCharMap = function () { + return CharMap.getCharMap(editor); + }; + + var insertChar = function (chr) { + Actions.insertChar(editor, chr); + }; + + return { + getCharMap: getCharMap, + insertChar: insertChar + }; + }; + + return { + get: get + }; + } +); + +/** + * GridHtml.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.ui.GridHtml', + [ + ], + function () { + var getHtml = function (charmap) { + var gridHtml, x, y; + var width = Math.min(charmap.length, 25); + var height = Math.ceil(charmap.length / width); + + gridHtml = '
'; + + for (y = 0; y < height; y++) { + gridHtml += '
'; + + return gridHtml; + }; + + return { + getHtml: getHtml + }; + } +); +/** + * Dialog.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.ui.Dialog', + [ + 'tinymce.plugins.charmap.core.Actions', + 'tinymce.plugins.charmap.core.CharMap', + 'tinymce.plugins.charmap.ui.GridHtml' + ], + function (Actions, CharMap, GridHtml) { + var getParentTd = function (elm) { + while (elm) { + if (elm.nodeName === 'TD') { + return elm; + } + + elm = elm.parentNode; + } + }; + + var open = function (editor) { + var win; + + var charMapPanel = { + type: 'container', + html: GridHtml.getHtml(CharMap.getCharMap(editor)), + onclick: function (e) { + var target = e.target; + + if (/^(TD|DIV)$/.test(target.nodeName)) { + var charDiv = getParentTd(target).firstChild; + if (charDiv && charDiv.hasAttribute('data-chr')) { + Actions.insertChar(editor, charDiv.getAttribute('data-chr')); + + if (!e.ctrlKey) { + win.close(); + } + } + } + }, + onmouseover: function (e) { + var td = getParentTd(e.target); + + if (td && td.firstChild) { + win.find('#preview').text(td.firstChild.firstChild.data); + win.find('#previewTitle').text(td.title); + } else { + win.find('#preview').text(' '); + win.find('#previewTitle').text(' '); + } + } + }; + + win = editor.windowManager.open({ + title: 'Special character', + spacing: 10, + padding: 10, + items: [ + charMapPanel, + { + type: 'container', + layout: 'flex', + direction: 'column', + align: 'center', + spacing: 5, + minWidth: 160, + minHeight: 160, + items: [ + { + type: 'label', + name: 'preview', + text: ' ', + style: 'font-size: 40px; text-align: center', + border: 1, + minWidth: 140, + minHeight: 80 + }, + { + type: 'spacer', + minHeight: 20 + }, + { + type: 'label', + name: 'previewTitle', + text: ' ', + style: 'white-space: pre-wrap;', + border: 1, + minWidth: 140 + } + ] + } + ], + buttons: [ + { + text: 'Close', + onclick: function () { + win.close(); + } + } + ] + }); + }; + + return { + open: open + }; + } +); +/** + * Commands.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.api.Commands', + [ + 'tinymce.plugins.charmap.ui.Dialog' + ], + function (Dialog) { + var register = function (editor) { + editor.addCommand('mceShowCharmap', function () { + Dialog.open(editor); + }); + }; + + return { + register: register + }; + } +); +/** + * Buttons.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.ui.Buttons', + [ + ], + function () { + var register = function (editor) { + editor.addButton('charmap', { + icon: 'charmap', + tooltip: 'Special character', + cmd: 'mceShowCharmap' + }); + + editor.addMenuItem('charmap', { + icon: 'charmap', + text: 'Special character', + cmd: 'mceShowCharmap', + context: 'insert' + }); + }; + + return { + register: register + }; + } +); +/** + * Plugin.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.charmap.Plugin', + [ + 'tinymce.core.PluginManager', + 'tinymce.plugins.charmap.api.Api', + 'tinymce.plugins.charmap.api.Commands', + 'tinymce.plugins.charmap.ui.Buttons' + ], + function (PluginManager, Api, Commands, Buttons) { + PluginManager.add('charmap', function (editor) { + Commands.register(editor); + Buttons.register(editor); + + return Api.get(editor); + }); + + return function () { }; + } +); + dem('tinymce.plugins.charmap.Plugin')(); +})(); diff --git a/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.min.js b/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.min.js new file mode 100644 index 000000000..591486d15 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/charmap/plugin.min.js @@ -0,0 +1 @@ +!(function () { var a = {}, b = function (b) { for (var c = a[b], e = c.deps, f = c.defn, g = e.length, h = new Array(g), i = 0; i < g; ++i)h[i] = d(e[i]); var j = f.apply(null, h); if (void 0 === j) throw 'module [' + b + '] returned undefined'; c.instance = j; }, c = function (b, c, d) { if (typeof b !== 'string') throw 'module id must be a string'; if (void 0 === c) throw 'no dependencies for ' + b; if (void 0 === d) throw 'no definition function for ' + b; a[b] = {deps: c, defn: d, instance: void 0}; }, d = function (c) { var d = a[c]; if (void 0 === d) throw 'module [' + c + '] was undefined'; return void 0 === d.instance && b(c), d.instance; }, e = function (a, b) { for (var c = a.length, e = new Array(c), f = 0; f < c; ++f)e[f] = d(a[f]); b.apply(null, e); }, f = {}; f.bolt = {module: {api: {define: c, require: e, demand: d}}}; var g = c, h = function (a, b) { g(a, [], function () { return b; }); }; h('5', tinymce.util.Tools.resolve), g('1', ['5'], function (a) { return a('tinymce.PluginManager'); }), g('9', [], function () { var a = function (a, b) { return a.fire('insertCustomChar', {chr: b}); }; return {fireInsertCustomChar: a}; }), g('6', ['9'], function (a) { var b = function (b, c) { var d = a.fireInsertCustomChar(b, c).chr; b.execCommand('mceInsertContent', !1, d); }; return {insertChar: b}; }), g('a', ['5'], function (a) { return a('tinymce.util.Tools'); }), g('b', [], function () { var a = function (a) { return a.settings.charmap; }, b = function (a) { return a.settings.charmap_append; }; return {getCharMap: a, getCharMapAppend: b}; }), g('7', ['a', 'b'], function (a, b) { var c = a.isArray, d = function () { return [['160', 'no-break space'], ['173', 'soft hyphen'], ['34', 'quotation mark'], ['162', 'cent sign'], ['8364', 'euro sign'], ['163', 'pound sign'], ['165', 'yen sign'], ['169', 'copyright sign'], ['174', 'registered sign'], ['8482', 'trade mark sign'], ['8240', 'per mille sign'], ['181', 'micro sign'], ['183', 'middle dot'], ['8226', 'bullet'], ['8230', 'three dot leader'], ['8242', 'minutes / feet'], ['8243', 'seconds / inches'], ['167', 'section sign'], ['182', 'paragraph sign'], ['223', 'sharp s / ess-zed'], ['8249', 'single left-pointing angle quotation mark'], ['8250', 'single right-pointing angle quotation mark'], ['171', 'left pointing guillemet'], ['187', 'right pointing guillemet'], ['8216', 'left single quotation mark'], ['8217', 'right single quotation mark'], ['8220', 'left double quotation mark'], ['8221', 'right double quotation mark'], ['8218', 'single low-9 quotation mark'], ['8222', 'double low-9 quotation mark'], ['60', 'less-than sign'], ['62', 'greater-than sign'], ['8804', 'less-than or equal to'], ['8805', 'greater-than or equal to'], ['8211', 'en dash'], ['8212', 'em dash'], ['175', 'macron'], ['8254', 'overline'], ['164', 'currency sign'], ['166', 'broken bar'], ['168', 'diaeresis'], ['161', 'inverted exclamation mark'], ['191', 'turned question mark'], ['710', 'circumflex accent'], ['732', 'small tilde'], ['176', 'degree sign'], ['8722', 'minus sign'], ['177', 'plus-minus sign'], ['247', 'division sign'], ['8260', 'fraction slash'], ['215', 'multiplication sign'], ['185', 'superscript one'], ['178', 'superscript two'], ['179', 'superscript three'], ['188', 'fraction one quarter'], ['189', 'fraction one half'], ['190', 'fraction three quarters'], ['402', 'function / florin'], ['8747', 'integral'], ['8721', 'n-ary sumation'], ['8734', 'infinity'], ['8730', 'square root'], ['8764', 'similar to'], ['8773', 'approximately equal to'], ['8776', 'almost equal to'], ['8800', 'not equal to'], ['8801', 'identical to'], ['8712', 'element of'], ['8713', 'not an element of'], ['8715', 'contains as member'], ['8719', 'n-ary product'], ['8743', 'logical and'], ['8744', 'logical or'], ['172', 'not sign'], ['8745', 'intersection'], ['8746', 'union'], ['8706', 'partial differential'], ['8704', 'for all'], ['8707', 'there exists'], ['8709', 'diameter'], ['8711', 'backward difference'], ['8727', 'asterisk operator'], ['8733', 'proportional to'], ['8736', 'angle'], ['180', 'acute accent'], ['184', 'cedilla'], ['170', 'feminine ordinal indicator'], ['186', 'masculine ordinal indicator'], ['8224', 'dagger'], ['8225', 'double dagger'], ['192', 'A - grave'], ['193', 'A - acute'], ['194', 'A - circumflex'], ['195', 'A - tilde'], ['196', 'A - diaeresis'], ['197', 'A - ring above'], ['256', 'A - macron'], ['198', 'ligature AE'], ['199', 'C - cedilla'], ['200', 'E - grave'], ['201', 'E - acute'], ['202', 'E - circumflex'], ['203', 'E - diaeresis'], ['274', 'E - macron'], ['204', 'I - grave'], ['205', 'I - acute'], ['206', 'I - circumflex'], ['207', 'I - diaeresis'], ['298', 'I - macron'], ['208', 'ETH'], ['209', 'N - tilde'], ['210', 'O - grave'], ['211', 'O - acute'], ['212', 'O - circumflex'], ['213', 'O - tilde'], ['214', 'O - diaeresis'], ['216', 'O - slash'], ['332', 'O - macron'], ['338', 'ligature OE'], ['352', 'S - caron'], ['217', 'U - grave'], ['218', 'U - acute'], ['219', 'U - circumflex'], ['220', 'U - diaeresis'], ['362', 'U - macron'], ['221', 'Y - acute'], ['376', 'Y - diaeresis'], ['562', 'Y - macron'], ['222', 'THORN'], ['224', 'a - grave'], ['225', 'a - acute'], ['226', 'a - circumflex'], ['227', 'a - tilde'], ['228', 'a - diaeresis'], ['229', 'a - ring above'], ['257', 'a - macron'], ['230', 'ligature ae'], ['231', 'c - cedilla'], ['232', 'e - grave'], ['233', 'e - acute'], ['234', 'e - circumflex'], ['235', 'e - diaeresis'], ['275', 'e - macron'], ['236', 'i - grave'], ['237', 'i - acute'], ['238', 'i - circumflex'], ['239', 'i - diaeresis'], ['299', 'i - macron'], ['240', 'eth'], ['241', 'n - tilde'], ['242', 'o - grave'], ['243', 'o - acute'], ['244', 'o - circumflex'], ['245', 'o - tilde'], ['246', 'o - diaeresis'], ['248', 'o slash'], ['333', 'o macron'], ['339', 'ligature oe'], ['353', 's - caron'], ['249', 'u - grave'], ['250', 'u - acute'], ['251', 'u - circumflex'], ['252', 'u - diaeresis'], ['363', 'u - macron'], ['253', 'y - acute'], ['254', 'thorn'], ['255', 'y - diaeresis'], ['563', 'y - macron'], ['913', 'Alpha'], ['914', 'Beta'], ['915', 'Gamma'], ['916', 'Delta'], ['917', 'Epsilon'], ['918', 'Zeta'], ['919', 'Eta'], ['920', 'Theta'], ['921', 'Iota'], ['922', 'Kappa'], ['923', 'Lambda'], ['924', 'Mu'], ['925', 'Nu'], ['926', 'Xi'], ['927', 'Omicron'], ['928', 'Pi'], ['929', 'Rho'], ['931', 'Sigma'], ['932', 'Tau'], ['933', 'Upsilon'], ['934', 'Phi'], ['935', 'Chi'], ['936', 'Psi'], ['937', 'Omega'], ['945', 'alpha'], ['946', 'beta'], ['947', 'gamma'], ['948', 'delta'], ['949', 'epsilon'], ['950', 'zeta'], ['951', 'eta'], ['952', 'theta'], ['953', 'iota'], ['954', 'kappa'], ['955', 'lambda'], ['956', 'mu'], ['957', 'nu'], ['958', 'xi'], ['959', 'omicron'], ['960', 'pi'], ['961', 'rho'], ['962', 'final sigma'], ['963', 'sigma'], ['964', 'tau'], ['965', 'upsilon'], ['966', 'phi'], ['967', 'chi'], ['968', 'psi'], ['969', 'omega'], ['8501', 'alef symbol'], ['982', 'pi symbol'], ['8476', 'real part symbol'], ['978', 'upsilon - hook symbol'], ['8472', 'Weierstrass p'], ['8465', 'imaginary part'], ['8592', 'leftwards arrow'], ['8593', 'upwards arrow'], ['8594', 'rightwards arrow'], ['8595', 'downwards arrow'], ['8596', 'left right arrow'], ['8629', 'carriage return'], ['8656', 'leftwards double arrow'], ['8657', 'upwards double arrow'], ['8658', 'rightwards double arrow'], ['8659', 'downwards double arrow'], ['8660', 'left right double arrow'], ['8756', 'therefore'], ['8834', 'subset of'], ['8835', 'superset of'], ['8836', 'not a subset of'], ['8838', 'subset of or equal to'], ['8839', 'superset of or equal to'], ['8853', 'circled plus'], ['8855', 'circled times'], ['8869', 'perpendicular'], ['8901', 'dot operator'], ['8968', 'left ceiling'], ['8969', 'right ceiling'], ['8970', 'left floor'], ['8971', 'right floor'], ['9001', 'left-pointing angle bracket'], ['9002', 'right-pointing angle bracket'], ['9674', 'lozenge'], ['9824', 'black spade suit'], ['9827', 'black club suit'], ['9829', 'black heart suit'], ['9830', 'black diamond suit'], ['8194', 'en space'], ['8195', 'em space'], ['8201', 'thin space'], ['8204', 'zero width non-joiner'], ['8205', 'zero width joiner'], ['8206', 'left-to-right mark'], ['8207', 'right-to-left mark']]; }, e = function (b) { return a.grep(b, function (a) { return c(a) && a.length === 2; }); }, f = function (a) { return c(a) ? [].concat(e(a)) : typeof a === 'function' ? a() : []; }, g = function (a, c) { var d = b.getCharMap(a); d && (c = f(d)); var e = b.getCharMapAppend(a); return e ? [].concat(c).concat(f(e)) : c; }, h = function (a) { return g(a, d()); }; return {getCharMap: h}; }), g('2', ['6', '7'], function (a, b) { var c = function (c) { var d = function () { return b.getCharMap(c); }, e = function (b) { a.insertChar(c, b); }; return {getCharMap: d, insertChar: e}; }; return {get: c}; }), g('c', [], function () { var a = function (a) { var b, c, d, e = Math.min(a.length, 25), f = Math.ceil(a.length / e); for (b = ''; + + for (x = 0; x < width; x++) { + var index = y * width + x; + if (index < charmap.length) { + var chr = charmap[index]; + var chrText = chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' '; + + gridHtml += ( + ' '; + } + + gridHtml += '' + + ' ' + ); + } else { + gridHtml += '' + + chrText + + '' + + ''; + } + } + + gridHtml += ' ', d = 0; d < f; d++) { for (b += '
'; }; return {getHtml: a}; }), g('8', ['6', '7', 'c'], function (a, b, c) { var d = function (a) { for (;a;) { if (a.nodeName === 'TD') return a; a = a.parentNode; } }, e = function (e) { var f, g = {type: 'container', html: c.getHtml(b.getCharMap(e)), onclick: function (b) { var c = b.target; if (/^(TD|DIV)$/.test(c.nodeName)) { var g = d(c).firstChild; g && g.hasAttribute('data-chr') && (a.insertChar(e, g.getAttribute('data-chr')), b.ctrlKey || f.close()); } }, onmouseover: function (a) { var b = d(a.target); b && b.firstChild ? (f.find('#preview').text(b.firstChild.firstChild.data), f.find('#previewTitle').text(b.title)) : (f.find('#preview').text(' '), f.find('#previewTitle').text(' ')); }}; f = e.windowManager.open({title: 'Special character', spacing: 10, padding: 10, items: [g, {type: 'container', layout: 'flex', direction: 'column', align: 'center', spacing: 5, minWidth: 160, minHeight: 160, items: [{type: 'label', name: 'preview', text: ' ', style: 'font-size: 40px; text-align: center', border: 1, minWidth: 140, minHeight: 80}, {type: 'spacer', minHeight: 20}, {type: 'label', name: 'previewTitle', text: ' ', style: 'white-space: pre-wrap;', border: 1, minWidth: 140}]}], buttons: [{text: 'Close', onclick: function () { f.close(); }}]}); }; return {open: e}; }), g('3', ['8'], function (a) { var b = function (b) { b.addCommand('mceShowCharmap', function () { a.open(b); }); }; return {register: b}; }), g('4', [], function () { var a = function (a) { a.addButton('charmap', {icon: 'charmap', tooltip: 'Special character', cmd: 'mceShowCharmap'}), a.addMenuItem('charmap', {icon: 'charmap', text: 'Special character', cmd: 'mceShowCharmap', context: 'insert'}); }; return {register: a}; }), g('0', ['1', '2', '3', '4'], function (a, b, c, d) { return a.add('charmap', function (a) { return c.register(a), d.register(a), b.get(a); }), function () {}; }), d('0')(); }()); diff --git a/src/views/my-components/text-editor/tinymce/plugins/code/index.js b/src/views/my-components/text-editor/tinymce/plugins/code/index.js new file mode 100644 index 000000000..8203d59a2 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/code/index.js @@ -0,0 +1,7 @@ +// Exports the "code" plugin for usage with module loaders +// Usage: +// CommonJS: +// require('tinymce/plugins/code') +// ES2015: +// import 'tinymce/plugins/code' +require('./plugin.js'); diff --git a/src/views/my-components/text-editor/tinymce/plugins/code/plugin.js b/src/views/my-components/text-editor/tinymce/plugins/code/plugin.js new file mode 100644 index 000000000..0c0d4c59d --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/code/plugin.js @@ -0,0 +1,325 @@ +(function () { + var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + +// Used when there is no 'main' module. +// The name is probably (hopefully) unique so minification removes for releases. + var register_3795 = function (id) { + var module = dem(id); + var fragments = id.split('.'); + var target = Function('return this;')(); + for (var i = 0; i < fragments.length - 1; ++i) { + if (target[fragments[i]] === undefined) { target[fragments[i]] = {}; } + target = target[fragments[i]]; + } + target[fragments[fragments.length - 1]] = module; + }; + + var instantiate = function (id) { + var actual = defs[id]; + var dependencies = actual.deps; + var definition = actual.defn; + var len = dependencies.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(dependencies[i]); } + var defResult = definition.apply(null, instances); + if (defResult === undefined) { throw 'module [' + id + '] returned undefined'; } + actual.instance = defResult; + }; + + var def = function (id, dependencies, definition) { + if (typeof id !== 'string') { throw 'module id must be a string'; } else if (dependencies === undefined) { throw 'no dependencies for ' + id; } else if (definition === undefined) { throw 'no definition function for ' + id; } + defs[id] = { + deps: dependencies, + defn: definition, + instance: undefined + }; + }; + + var dem = function (id) { + var actual = defs[id]; + if (actual === undefined) { throw 'module [' + id + '] was undefined'; } else if (actual.instance === undefined) { instantiate(id); } + return actual.instance; + }; + + var req = function (ids, callback) { + var len = ids.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(ids[i]); } + callback.apply(null, instances); + }; + + var ephox = {}; + + ephox.bolt = { + module: { + api: { + define: def, + require: req, + demand: dem + } + } + }; + + var define = def; + var require = req; + var demand = dem; +// this helps with minification when using a lot of global references + var defineGlobal = function (id, ref) { + define(id, [], function () { return ref; }); + }; +/* jsc +["tinymce.plugins.code.Plugin","tinymce.core.PluginManager","tinymce.plugins.code.api.Commands","tinymce.plugins.code.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.code.ui.Dialog","tinymce.plugins.code.api.Settings","tinymce.plugins.code.core.Content","tinymce.core.dom.DOMUtils"] +jsc */ + defineGlobal('global!tinymce.util.Tools.resolve', tinymce.util.Tools.resolve); +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.PluginManager', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.PluginManager'); + } +); + +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.dom.DOMUtils', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.dom.DOMUtils'); + } +); + +/** + * Settings.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.api.Settings', + [ + 'tinymce.core.dom.DOMUtils' + ], + function (DOMUtils) { + var getMinWidth = function (editor) { + return editor.getParam('code_dialog_width', 600); + }; + + var getMinHeight = function (editor) { + return editor.getParam('code_dialog_height', Math.min(DOMUtils.DOM.getViewPort().h - 200, 500)); + }; + + return { + getMinWidth: getMinWidth, + getMinHeight: getMinHeight + }; + } +); +/** + * Content.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.core.Content', + [ + ], + function () { + var setContent = function (editor, html) { + // We get a lovely "Wrong document" error in IE 11 if we + // don't move the focus to the editor before creating an undo + // transation since it tries to make a bookmark for the current selection + editor.focus(); + + editor.undoManager.transact(function () { + editor.setContent(html); + }); + + editor.selection.setCursorLocation(); + editor.nodeChanged(); + }; + + var getContent = function (editor) { + return editor.getContent({ source_view: true }); + }; + + return { + setContent: setContent, + getContent: getContent + }; + } +); +/** + * Dialog.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.ui.Dialog', + [ + 'tinymce.plugins.code.api.Settings', + 'tinymce.plugins.code.core.Content' + ], + function (Settings, Content) { + var open = function (editor) { + var minWidth = Settings.getMinWidth(editor); + var minHeight = Settings.getMinHeight(editor); + + var win = editor.windowManager.open({ + title: 'Source code', + body: { + type: 'textbox', + name: 'code', + multiline: true, + minWidth: minWidth, + minHeight: minHeight, + spellcheck: false, + style: 'direction: ltr; text-align: left' + }, + onSubmit: function (e) { + Content.setContent(editor, e.data.code); + } + }); + + // Gecko has a major performance issue with textarea + // contents so we need to set it when all reflows are done + win.find('#code').value(Content.getContent(editor)); + }; + + return { + open: open + }; + } +); +/** + * Commands.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.api.Commands', + [ + 'tinymce.plugins.code.ui.Dialog' + ], + function (Dialog) { + var register = function (editor) { + editor.addCommand('mceCodeEditor', function () { + Dialog.open(editor); + }); + }; + + return { + register: register + }; + } +); +/** + * Buttons.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.ui.Buttons', + [ + 'tinymce.plugins.code.ui.Dialog' + ], + function (Dialog) { + var register = function (editor) { + editor.addButton('code', { + icon: 'code', + tooltip: 'Source code', + onclick: function () { + Dialog.open(editor); + } + }); + + editor.addMenuItem('code', { + icon: 'code', + text: 'Source code', + onclick: function () { + Dialog.open(editor); + } + }); + }; + + return { + register: register + }; + } +); +/** + * Plugin.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.code.Plugin', + [ + 'tinymce.core.PluginManager', + 'tinymce.plugins.code.api.Commands', + 'tinymce.plugins.code.ui.Buttons' + ], + function (PluginManager, Commands, Buttons) { + PluginManager.add('code', function (editor) { + Commands.register(editor); + Buttons.register(editor); + + return {}; + }); + + return function () { }; + } +); + dem('tinymce.plugins.code.Plugin')(); +})(); diff --git a/src/views/my-components/text-editor/tinymce/plugins/code/plugin.min.js b/src/views/my-components/text-editor/tinymce/plugins/code/plugin.min.js new file mode 100644 index 000000000..9b724928c --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/code/plugin.min.js @@ -0,0 +1 @@ +!(function () { var a = {}, b = function (b) { for (var c = a[b], e = c.deps, f = c.defn, g = e.length, h = new Array(g), i = 0; i < g; ++i)h[i] = d(e[i]); var j = f.apply(null, h); if (void 0 === j) throw 'module [' + b + '] returned undefined'; c.instance = j; }, c = function (b, c, d) { if (typeof b !== 'string') throw 'module id must be a string'; if (void 0 === c) throw 'no dependencies for ' + b; if (void 0 === d) throw 'no definition function for ' + b; a[b] = {deps: c, defn: d, instance: void 0}; }, d = function (c) { var d = a[c]; if (void 0 === d) throw 'module [' + c + '] was undefined'; return void 0 === d.instance && b(c), d.instance; }, e = function (a, b) { for (var c = a.length, e = new Array(c), f = 0; f < c; ++f)e[f] = d(a[f]); b.apply(null, e); }, f = {}; f.bolt = {module: {api: {define: c, require: e, demand: d}}}; var g = c, h = function (a, b) { g(a, [], function () { return b; }); }; h('4', tinymce.util.Tools.resolve), g('1', ['4'], function (a) { return a('tinymce.PluginManager'); }), g('8', ['4'], function (a) { return a('tinymce.dom.DOMUtils'); }), g('6', ['8'], function (a) { var b = function (a) { return a.getParam('code_dialog_width', 600); }, c = function (b) { return b.getParam('code_dialog_height', Math.min(a.DOM.getViewPort().h - 200, 500)); }; return {getMinWidth: b, getMinHeight: c}; }), g('7', [], function () { var a = function (a, b) { a.focus(), a.undoManager.transact(function () { a.setContent(b); }), a.selection.setCursorLocation(), a.nodeChanged(); }, b = function (a) { return a.getContent({source_view: !0}); }; return {setContent: a, getContent: b}; }), g('5', ['6', '7'], function (a, b) { var c = function (c) { var d = a.getMinWidth(c), e = a.getMinHeight(c), f = c.windowManager.open({title: 'Source code', body: {type: 'textbox', name: 'code', multiline: !0, minWidth: d, minHeight: e, spellcheck: !1, style: 'direction: ltr; text-align: left'}, onSubmit: function (a) { b.setContent(c, a.data.code); }}); f.find('#code').value(b.getContent(c)); }; return {open: c}; }), g('2', ['5'], function (a) { var b = function (b) { b.addCommand('mceCodeEditor', function () { a.open(b); }); }; return {register: b}; }), g('3', ['5'], function (a) { var b = function (b) { b.addButton('code', {icon: 'code', tooltip: 'Source code', onclick: function () { a.open(b); }}), b.addMenuItem('code', {icon: 'code', text: 'Source code', onclick: function () { a.open(b); }}); }; return {register: b}; }), g('0', ['1', '2', '3'], function (a, b, c) { return a.add('code', function (a) { return b.register(a), c.register(a), {}; }), function () {}; }), d('0')(); }()); diff --git a/src/views/my-components/text-editor/tinymce/plugins/codesample/css/prism.css b/src/views/my-components/text-editor/tinymce/plugins/codesample/css/prism.css new file mode 100644 index 000000000..128237fba --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/codesample/css/prism.css @@ -0,0 +1,138 @@ +/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript */ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*="language-"], +pre[class*="language-"] { + color: black; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, +code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*="language-"]::selection, pre[class*="language-"] ::selection, +code[class*="language-"]::selection, code[class*="language-"] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*="language-"], + pre[class*="language-"] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"], +pre[class*="language-"] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.namespace { + opacity: .7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #a67f59; + background: hsla(0, 0%, 100%, .5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function { + color: #DD4A68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + diff --git a/src/views/my-components/text-editor/tinymce/plugins/codesample/index.js b/src/views/my-components/text-editor/tinymce/plugins/codesample/index.js new file mode 100644 index 000000000..6907ab359 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/codesample/index.js @@ -0,0 +1,7 @@ +// Exports the "codesample" plugin for usage with module loaders +// Usage: +// CommonJS: +// require('tinymce/plugins/codesample') +// ES2015: +// import 'tinymce/plugins/codesample' +require('./plugin.js'); diff --git a/src/views/my-components/text-editor/tinymce/plugins/codesample/plugin.js b/src/views/my-components/text-editor/tinymce/plugins/codesample/plugin.js new file mode 100644 index 000000000..306fe5e95 --- /dev/null +++ b/src/views/my-components/text-editor/tinymce/plugins/codesample/plugin.js @@ -0,0 +1,1561 @@ +(function () { + var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)} + +// Used when there is no 'main' module. +// The name is probably (hopefully) unique so minification removes for releases. + var register_3795 = function (id) { + var module = dem(id); + var fragments = id.split('.'); + var target = Function('return this;')(); + for (var i = 0; i < fragments.length - 1; ++i) { + if (target[fragments[i]] === undefined) { target[fragments[i]] = {}; } + target = target[fragments[i]]; + } + target[fragments[fragments.length - 1]] = module; + }; + + var instantiate = function (id) { + var actual = defs[id]; + var dependencies = actual.deps; + var definition = actual.defn; + var len = dependencies.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(dependencies[i]); } + var defResult = definition.apply(null, instances); + if (defResult === undefined) { throw 'module [' + id + '] returned undefined'; } + actual.instance = defResult; + }; + + var def = function (id, dependencies, definition) { + if (typeof id !== 'string') { throw 'module id must be a string'; } else if (dependencies === undefined) { throw 'no dependencies for ' + id; } else if (definition === undefined) { throw 'no definition function for ' + id; } + defs[id] = { + deps: dependencies, + defn: definition, + instance: undefined + }; + }; + + var dem = function (id) { + var actual = defs[id]; + if (actual === undefined) { throw 'module [' + id + '] was undefined'; } else if (actual.instance === undefined) { instantiate(id); } + return actual.instance; + }; + + var req = function (ids, callback) { + var len = ids.length; + var instances = new Array(len); + for (var i = 0; i < len; ++i) { instances[i] = dem(ids[i]); } + callback.apply(null, instances); + }; + + var ephox = {}; + + ephox.bolt = { + module: { + api: { + define: def, + require: req, + demand: dem + } + } + }; + + var define = def; + var require = req; + var demand = dem; +// this helps with minification when using a lot of global references + var defineGlobal = function (id, ref) { + define(id, [], function () { return ref; }); + }; +/* jsc +["tinymce.plugins.codesample.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.codesample.api.Commands","tinymce.plugins.codesample.core.FilterContent","tinymce.plugins.codesample.core.LoadCss","tinymce.plugins.codesample.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.codesample.ui.Dialog","tinymce.plugins.codesample.util.Utils","tinymce.plugins.codesample.core.Prism","tinymce.plugins.codesample.api.Settings","tinymce.core.dom.DOMUtils","tinymce.plugins.codesample.core.CodeSample","tinymce.plugins.codesample.core.Languages"] +jsc */ + define( + 'ephox.katamari.api.Cell', + + [ + ], + + function () { + var Cell = function (initial) { + var value = initial; + + var get = function () { + return value; + }; + + var set = function (v) { + value = v; + }; + + var clone = function () { + return Cell(get()); + }; + + return { + get: get, + set: set, + clone: clone + }; + }; + + return Cell; + } +); + + defineGlobal('global!tinymce.util.Tools.resolve', tinymce.util.Tools.resolve); +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.PluginManager', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.PluginManager'); + } +); + +/** + * ResolveGlobal.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.core.dom.DOMUtils', + [ + 'global!tinymce.util.Tools.resolve' + ], + function (resolve) { + return resolve('tinymce.dom.DOMUtils'); + } +); + +/** + * Settings.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + */ + + define( + 'tinymce.plugins.codesample.api.Settings', + [ + 'tinymce.core.dom.DOMUtils' + ], + function (DOMUtils) { + var getContentCss = function (editor) { + return editor.settings.codesample_content_css; + }; + + var getLanguages = function (editor) { + return editor.settings.codesample_languages; + }; + + var getDialogMinWidth = function (editor) { + return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_width', 800)); + }; + + var getDialogMinHeight = function (editor) { + return Math.min(DOMUtils.DOM.getViewPort().w, editor.getParam('codesample_dialog_height', 650)); + }; + + return { + getContentCss: getContentCss, + getLanguages: getLanguages, + getDialogMinWidth: getDialogMinWidth, + getDialogMinHeight: getDialogMinHeight + }; + } +); +/** + * Prism.js + * + * Released under LGPL License. + * Copyright (c) 1999-2017 Ephox Corp. All rights reserved + * + * License: http://www.tinymce.com/license + * Contributing: http://www.tinymce.com/contributing + * + * Import of prism. Disabled DOMContentLoaded event listener. + */ + +/*eslint-disable*/ + +define( + 'tinymce.plugins.codesample.core.Prism', + [ + ], + function () { + var window = {}; + // ------------------ Start wrap + + /* http://prismjs.com/download.html?themes=prism-dark&languages=markup+css+clike+javascript+c+csharp+cpp+java+php+python+ruby */ + var _self = (typeof window !== 'undefined') + ? window // if in browser + : ( + (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) + ? self // if in worker + : {} // if in node js + ); + + /** + * Prism: Lightweight, robust, elegant syntax highlighting + * MIT license http://www.opensource.org/licenses/mit-license.php/ + * @author Lea Verou http://lea.verou.me + */ + + var Prism = (function () { + + // Private helper vars + var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; + + var _ = _self.Prism = { + util: { + encode: function (tokens) { + if (tokens instanceof Token) { + return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); + } else if (_.util.type(tokens) === 'Array') { + return tokens.map(_.util.encode); + } else { + return tokens.replace(/&/g, '&').replace(/ text.length) { + // Something went terribly wrong, ABORT, ABORT! + break tokenloop; + } + + if (str instanceof Token) { + continue; + } + + pattern.lastIndex = 0; + + var match = pattern.exec(str); + + if (match) { + if (lookbehind) { + lookbehindLength = match[1].length; + } + + var from = match.index - 1 + lookbehindLength, + match = match[0].slice(lookbehindLength), + len = match.length, + to = from + len, + before = str.slice(0, from + 1), + after = str.slice(to + 1); + + var args = [i, 1]; + + if (before) { + args.push(before); + } + + var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias); + + args.push(wrapped); + + if (after) { + args.push(after); + } + + Array.prototype.splice.apply(strarr, args); + } + } + } + } + + return strarr; + }, + + hooks: { + all: {}, + + add: function (name, callback) { + var hooks = _.hooks.all; + + hooks[name] = hooks[name] || []; + + hooks[name].push(callback); + }, + + run: function (name, env) { + var callbacks = _.hooks.all[name]; + + if (!callbacks || !callbacks.length) { + return; + } + + for (var i = 0, callback; callback = callbacks[i++];) { + callback(env); + } + } + } + }; + + var Token = _.Token = function (type, content, alias) { + this.type = type; + this.content = content; + this.alias = alias; + }; + + Token.stringify = function (o, language, parent) { + if (typeof o == 'string') { + return o; + } + + if (_.util.type(o) === 'Array') { + return o.map(function (element) { + return Token.stringify(element, language, o); + }).join(''); + } + + var env = { + type: o.type, + content: Token.stringify(o.content, language, parent), + tag: 'span', + classes: ['token', o.type], + attributes: {}, + language: language, + parent: parent + }; + + if (env.type == 'comment') { + env.attributes['spellcheck'] = 'true'; + } + + if (o.alias) { + var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; + Array.prototype.push.apply(env.classes, aliases); + } + + _.hooks.run('wrap', env); + + var attributes = ''; + + for (var name in env.attributes) { + attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"'; + } + + return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + '' + env.tag + '>'; + + }; + + if (!_self.document) { + if (!_self.addEventListener) { + // in Node.js + return _self.Prism; + } + // In worker + _self.addEventListener('message', function (evt) { + var message = JSON.parse(evt.data), + lang = message.language, + code = message.code, + immediateClose = message.immediateClose; + + _self.postMessage(_.highlight(code, _.languages[lang], lang)); + if (immediateClose) { + _self.close(); + } + }, false); + + return _self.Prism; + } + /* + // Get current script and highlight + var script = document.getElementsByTagName('script'); + + script = script[script.length - 1]; + + if (script) { + _.filename = script.src; + + if (document.addEventListener && !script.hasAttribute('data-manual')) { + document.addEventListener('DOMContentLoaded', _.highlightAll); + } + } + + return _self.Prism; + */ + })(); + + if (typeof module !== 'undefined' && module.exports) { + module.exports = Prism; + } + + // hack for components to work correctly in node.js + if (typeof global !== 'undefined') { + global.Prism = Prism; + } + ; + Prism.languages.markup = { + 'comment': //, + 'prolog': /<\?[\w\W]+?\?>/, + 'doctype': //, + 'cdata': //i, + 'tag': { + pattern: /<\/?[^\s>\/=.]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i, + inside: { + 'tag': { + pattern: /^<\/?[^\s>\/]+/i, + inside: { + 'punctuation': /^<\/?/, + 'namespace': /^[^\s>\/:]+:/ + } + }, + 'attr-value': { + pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, + inside: { + 'punctuation': /[=>"']/ + } + }, + 'punctuation': /\/?>/, + 'attr-name': { + pattern: /[^\s>\/]+/, + inside: { + 'namespace': /^[^\s>\/:]+:/ + } + } + + } + }, + 'entity': /?[\da-z]{1,8};/i + }; + + // Plugin to make entity title show the real entity, idea by Roman Komarov + Prism.hooks.add('wrap', function (env) { + + if (env.type === 'entity') { + env.attributes['title'] = env.content.replace(/&/, '&'); + } + }); + + Prism.languages.xml = Prism.languages.markup; + Prism.languages.html = Prism.languages.markup; + Prism.languages.mathml = Prism.languages.markup; + Prism.languages.svg = Prism.languages.markup; + + Prism.languages.css = { + 'comment': /\/\*[\w\W]*?\*\//, + 'atrule': { + pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, + inside: { + 'rule': /@[\w-]+/ + // See rest below + } + }, + 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, + 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/, + 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/, + 'property': /(\b|\B)[\w-]+(?=\s*:)/i, + 'important': /\B!important\b/i, + 'function': /[-a-z0-9]+(?=\()/i, + 'punctuation': /[(){};:]/ + }; + + Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); + + if (Prism.languages.markup) { + Prism.languages.insertBefore('markup', 'tag', { + 'style': { + pattern: / + + +', c = 0; c < e; c++) { var g = d * e + c; if (g < a.length) { var h = a[g], i = h ? String.fromCharCode(parseInt(h[0], 10)) : ' '; b += ' '; } return b += ''; } else b += ' ' + i + ''; }b += ' ++ + + diff --git a/src/views/tables/components/ExportExcel.vue b/src/views/tables/components/ExportExcel.vue new file mode 100644 index 000000000..2f0060418 --- /dev/null +++ b/src/views/tables/components/ExportExcel.vue @@ -0,0 +1,21 @@ + + + + + diff --git a/src/views/tables/components/canEditTable.vue b/src/views/tables/components/canEditTable.vue new file mode 100644 index 000000000..bedc4d040 --- /dev/null +++ b/src/views/tables/components/canEditTable.vue @@ -0,0 +1,288 @@ + + + ++ ++
++ 个人信息 + + +++ +修改密码
+ ++ + ++++ + + diff --git a/src/views/tables/components/dragableTable.vue b/src/views/tables/components/dragableTable.vue new file mode 100644 index 000000000..13766b34a --- /dev/null +++ b/src/views/tables/components/dragableTable.vue @@ -0,0 +1,51 @@ + ++
++ + + diff --git a/src/views/tables/components/editable-table.less b/src/views/tables/components/editable-table.less new file mode 100644 index 000000000..3f498248d --- /dev/null +++ b/src/views/tables/components/editable-table.less @@ -0,0 +1,7 @@ +.show-edit-btn{ + display: none; + margin-left: -10px; +} +.ivu-table-cell:hover .show-edit-btn{ + display: inline-block; +} \ No newline at end of file diff --git a/src/views/tables/components/multiPageTable.vue b/src/views/tables/components/multiPageTable.vue new file mode 100644 index 000000000..431bd0797 --- /dev/null +++ b/src/views/tables/components/multiPageTable.vue @@ -0,0 +1,111 @@ + ++
++ + diff --git a/src/views/tables/components/table.less b/src/views/tables/components/table.less new file mode 100644 index 000000000..908f070cd --- /dev/null +++ b/src/views/tables/components/table.less @@ -0,0 +1,70 @@ +.dragging-tip-enter-active{ + opacity: 1; + transition: opacity .3s; +} +.dragging-tip-enter, .dragging-tip-leave-to{ + opacity: 0; + transition: opacity .3s +} +.dragging-tip-con{ + display: block; + text-align: center; + width: 100%; + height: 50px; +} +.dragging-tip-con span{ + font-size: 18px; +} +.record-tip-con{ + display: block; + width: 100%; + height: 292px; + overflow: auto; +} +.record-item{ + box-sizing: content-box; + display: block; + overflow: hidden; + height: 24px; + line-height: 24px; + padding: 8px 10px; + border-bottom: 1px dashed gainsboro; +} +.record-tip-con span{ + font-size: 14px; +} +.edittable-test-con{ + height: 160px; +} +.edittable-table-height-con{ + height: 190px; +} +.edittable-con-1{ + box-sizing: content-box; + padding: 15px 0 0; + height: 196px; +} +.edittable-table-get-currentdata-con{ + height: 190px !important; +} +.exportable-table-download-con1{ + padding: 16px 0 16px 20px; + border-bottom: 1px dashed #c3c3c3; + margin-bottom: 16px; +} +.exportable-table-download-con2{ + padding-left: 20px; +} +.show-image{ + padding: 20px 0px; +} +.show-image img{ + display: block; + width: 100%; + height: auto; +} +.searchable-table{ + &-con1{ + height: 230px !important; + } +} \ No newline at end of file diff --git a/src/views/tables/components/table_data.js b/src/views/tables/components/table_data.js new file mode 100644 index 000000000..8784417f6 --- /dev/null +++ b/src/views/tables/components/table_data.js @@ -0,0 +1,251 @@ +export const table1Columns = [ + { + title: '序号', + type: 'index', + width: 80, + align: 'center' + }, + { + title: '姓名', + align: 'center', + key: 'name', + editable: true + }, + { + title: '性别', + align: 'center', + key: 'sex' + }, + { + title: '岗位', + align: 'center', + key: 'work', + editable: true + }, + { + title: '操作', + align: 'center', + width: 120, + key: 'handle', + handle: ['delete'] + } +]; + +export const table1Data = [ + { + name: 'Aresn', + sex: '男', + work: '前端开发' + }, + { + name: 'Lison', + sex: '男', + work: '前端开发' + }, + { + name: 'lisa', + sex: '女', + work: '程序员鼓励师' + } +]; + +export const editInlineColumns = [ + { + title: '序号', + type: 'index', + width: 80, + align: 'center' + }, + { + title: '姓名', + align: 'center', + key: 'name', + width: 90, + editable: true + }, + { + title: '性别', + align: 'center', + key: 'sex' + }, + { + title: '岗位', + align: 'center', + key: 'work', + width: 150, + editable: true + }, + { + title: '操作', + align: 'center', + width: 190, + key: 'handle', + handle: ['edit', 'delete'] + } +]; + +export const editInlineData = [ + { + name: 'Aresn', + sex: '男', + work: '前端开发' + }, + { + name: 'Lison', + sex: '男', + work: '前端开发' + }, + { + name: 'lisa', + sex: '女', + work: '程序员鼓励师' + } +]; + +export const editIncellColumns = [ + { + title: '序号', + type: 'index', + width: 80, + align: 'center' + }, + { + title: '姓名', + align: 'center', + key: 'name', + width: 120, + editable: true + }, + { + title: '性别', + align: 'center', + key: 'sex' + }, + { + title: '岗位', + align: 'center', + width: 160, + key: 'work', + editable: true + }, + { + title: '操作', + align: 'center', + width: 120, + key: 'handle', + handle: ['delete'] + } +]; + +export const editIncellData = [ + { + name: 'Aresn', + sex: '男', + work: '前端开发' + }, + { + name: 'Lison', + sex: '男', + work: '前端开发' + }, + { + name: 'lisa', + sex: '女', + work: '程序员鼓励师' + } +]; + +export const editInlineAndCellColumn = [ + { + title: '序号', + type: 'index', + width: 80, + align: 'center' + }, + { + title: '姓名', + align: 'center', + key: 'name', + width: 300, + editable: true + }, + { + title: '性别', + align: 'center', + key: 'sex' + }, + { + title: '岗位', + align: 'center', + width: 300, + key: 'work', + editable: true + }, + { + title: '操作', + align: 'center', + width: 200, + key: 'handle', + handle: ['edit', 'delete'] + } +]; + +export const editInlineAndCellData = [ + { + name: 'Aresn', + sex: '男', + work: '前端开发' + }, + { + name: 'Lison', + sex: '男', + work: '前端开发' + }, + { + name: 'lisa', + sex: '女', + work: '程序员鼓励师' + } +]; + +export const showCurrentColumns = [ + { + title: '序号', + type: 'index', + width: 80, + align: 'center' + }, + { + title: '姓名', + align: 'center', + key: 'name', + width: 300, + editable: true + }, + { + title: '性别', + align: 'center', + key: 'sex' + }, + { + title: '岗位', + align: 'center', + width: 300, + key: 'work', + editable: true + } +]; + +const tableData = { + table1Columns: table1Columns, + table1Data: table1Data, + editInlineColumns: editInlineColumns, + editInlineData: editInlineData, + editIncellColumns: editIncellColumns, + editIncellData: editIncellData, + editInlineAndCellColumn: editInlineAndCellColumn, + editInlineAndCellData: editInlineAndCellData, + showCurrentColumns: showCurrentColumns +}; + +export default tableData; diff --git a/src/views/tables/data/search.js b/src/views/tables/data/search.js new file mode 100644 index 000000000..4c756edcd --- /dev/null +++ b/src/views/tables/data/search.js @@ -0,0 +1,67 @@ +export const columns1 = [ + { + key: 'name', + title: '姓名' + }, + { + key: 'tel', + title: '电话号码' + } +]; + +export const searchTable1 = [ + { + name: 'Aresn', + tel: '17712345678' + }, + { + name: 'Lison', + tel: '17787654321' + }, + { + name: 'Lili', + tel: '12212345678' + }, + { + name: 'Lucy', + tel: '13312345678' + } +]; + +export const searchTable2 = [ + { + name: 'Aresn', + tel: '17712345678' + }, + { + name: 'Lison', + tel: '17787654321' + }, + { + name: 'Lili', + tel: '12212345678' + }, + { + name: 'Lucy', + tel: '13312345678' + } +]; + +export const searchTable3 = [ + { + name: 'Aresn', + tel: '17712345678' + }, + { + name: 'Lison', + tel: '17787654321' + }, + { + name: 'Lili', + tel: '12212345678' + }, + { + name: 'Lucy', + tel: '13312345678' + } +]; diff --git a/src/views/tables/data/table2csv.js b/src/views/tables/data/table2csv.js new file mode 100644 index 000000000..6d6621cd3 --- /dev/null +++ b/src/views/tables/data/table2csv.js @@ -0,0 +1,200 @@ +export const table2csvData = [ + { + 'name': '推广名称1', + 'fav': 0, + 'show': 7302, + 'weak': 5627, + 'signin': 1563, + 'click': 4254, + 'active': 1438, + 'day7': 274, + 'day30': 285, + 'tomorrow': 1727, + 'day': 558, + 'week': 4440, + 'month': 5610 + }, + { + 'name': '推广名称2', + 'fav': 0, + 'show': 4720, + 'weak': 4086, + 'signin': 3792, + 'click': 8690, + 'active': 8470, + 'day7': 8172, + 'day30': 5197, + 'tomorrow': 1684, + 'day': 2593, + 'week': 2507, + 'month': 1537 + }, + { + 'name': '推广名称3', + 'fav': 0, + 'show': 7181, + 'weak': 8007, + 'signin': 8477, + 'click': 1879, + 'active': 16, + 'day7': 2249, + 'day30': 3450, + 'tomorrow': 377, + 'day': 1561, + 'week': 3219, + 'month': 1588 + }, + { + 'name': '推广名称4', + 'fav': 0, + 'show': 9911, + 'weak': 8976, + 'signin': 8807, + 'click': 8050, + 'active': 7668, + 'day7': 1547, + 'day30': 2357, + 'tomorrow': 7278, + 'day': 5309, + 'week': 1655, + 'month': 9043 + }, + { + 'name': '推广名称5', + 'fav': 0, + 'show': 934, + 'weak': 1394, + 'signin': 6463, + 'click': 5278, + 'active': 9256, + 'day7': 209, + 'day30': 3563, + 'tomorrow': 8285, + 'day': 1230, + 'week': 4840, + 'month': 9908 + }, + { + 'name': '推广名称6', + 'fav': 0, + 'show': 6856, + 'weak': 1608, + 'signin': 457, + 'click': 4949, + 'active': 2909, + 'day7': 4525, + 'day30': 6171, + 'tomorrow': 1920, + 'day': 1966, + 'week': 904, + 'month': 6851 + }, + { + 'name': '推广名称7', + 'fav': 0, + 'show': 5107, + 'weak': 6407, + 'signin': 4166, + 'click': 7970, + 'active': 1002, + 'day7': 8701, + 'day30': 9040, + 'tomorrow': 7632, + 'day': 4061, + 'week': 4359, + 'month': 3676 + } +]; + +export const csvColumns = [ + { + 'title': '名称', + 'key': 'name', + 'fixed': 'left', + 'width': 200 + }, + { + 'title': '展示', + 'key': 'show', + 'width': 150, + 'sortable': true, + filters: [ + { + label: '大于4000', + value: 1 + }, + { + label: '小于4000', + value: 2 + } + ], + filterMultiple: false, + filterMethod (value, row) { + if (value === 1) { + return row.show > 4000; + } else if (value === 2) { + return row.show < 4000; + } + } + }, + { + 'title': '唤醒', + 'key': 'weak', + 'width': 150, + 'sortable': true + }, + { + 'title': '登录', + 'key': 'signin', + 'width': 150, + 'sortable': true + }, + { + 'title': '点击', + 'key': 'click', + 'width': 150, + 'sortable': true + }, + { + 'title': '激活', + 'key': 'active', + 'width': 150, + 'sortable': true + }, + { + 'title': '7日留存', + 'key': 'day7', + 'width': 150, + 'sortable': true + }, + { + 'title': '30日留存', + 'key': 'day30', + 'width': 150, + 'sortable': true + }, + { + 'title': '次日留存', + 'key': 'tomorrow', + 'width': 150, + 'sortable': true + }, + { + 'title': '日活跃', + 'key': 'day', + 'width': 150, + 'sortable': true + }, + { + 'title': '周活跃', + 'key': 'week', + 'width': 150, + 'sortable': true + }, + { + 'title': '月活跃', + 'key': 'month', + 'width': 150, + 'sortable': true + } +]; diff --git a/src/views/tables/data/table2excel.js b/src/views/tables/data/table2excel.js new file mode 100644 index 000000000..aa5979713 --- /dev/null +++ b/src/views/tables/data/table2excel.js @@ -0,0 +1,212 @@ +export const table2excelData = [ + { + 'name': '推广名称1', + 'fav': 0, + 'show': 7302, + 'weak': 5627, + 'signin': 1563, + 'click': 4254, + 'active': 1438, + 'day7': 274, + 'day30': 285, + 'tomorrow': 1727, + 'day': 558, + 'week': 4440, + 'month': 5610 + }, + { + 'name': '推广名称2', + 'fav': 0, + 'show': 4720, + 'weak': 4086, + 'signin': 3792, + 'click': 8690, + 'active': 8470, + 'day7': 8172, + 'day30': 5197, + 'tomorrow': 1684, + 'day': 2593, + 'week': 2507, + 'month': 1537 + }, + { + 'name': '推广名称3', + 'fav': 0, + 'show': 7181, + 'weak': 8007, + 'signin': 8477, + 'click': 1879, + 'active': 16, + 'day7': 2249, + 'day30': 3450, + 'tomorrow': 377, + 'day': 1561, + 'week': 3219, + 'month': 1588 + }, + { + 'name': '推广名称4', + 'fav': 0, + 'show': 9911, + 'weak': 8976, + 'signin': 8807, + 'click': 8050, + 'active': 7668, + 'day7': 1547, + 'day30': 2357, + 'tomorrow': 7278, + 'day': 5309, + 'week': 1655, + 'month': 9043 + }, + { + 'name': '推广名称5', + 'fav': 0, + 'show': 934, + 'weak': 1394, + 'signin': 6463, + 'click': 5278, + 'active': 9256, + 'day7': 209, + 'day30': 3563, + 'tomorrow': 8285, + 'day': 1230, + 'week': 4840, + 'month': 9908 + }, + { + 'name': '推广名称6', + 'fav': 0, + 'show': 6856, + 'weak': 1608, + 'signin': 457, + 'click': 4949, + 'active': 2909, + 'day7': 4525, + 'day30': 6171, + 'tomorrow': 1920, + 'day': 1966, + 'week': 904, + 'month': 6851 + }, + { + 'name': '推广名称7', + 'fav': 0, + 'show': 5107, + 'weak': 6407, + 'signin': 4166, + 'click': 7970, + 'active': 1002, + 'day7': 8701, + 'day30': 9040, + 'tomorrow': 7632, + 'day': 4061, + 'week': 4359, + 'month': 3676 + }, + { + 'name': '推广名称8', + 'fav': 0, + 'show': 5107, + 'weak': 6407, + 'signin': 4166, + 'click': 7970, + 'active': 1002, + 'day7': 8701, + 'day30': 9040, + 'tomorrow': 7632, + 'day': 4061, + 'week': 4359, + 'month': 3676 + }, + { + 'name': '推广名称9', + 'fav': 0, + 'show': 5107, + 'weak': 6407, + 'signin': 4166, + 'click': 7970, + 'active': 1002, + 'day7': 8701, + 'day30': 9040, + 'tomorrow': 7632, + 'day': 4061, + 'week': 4359, + 'month': 3676 + }, + { + 'name': '推广名称10', + 'fav': 0, + 'show': 5107, + 'weak': 6407, + 'signin': 4166, + 'click': 7970, + 'active': 1002, + 'day7': 8701, + 'day30': 9040, + 'tomorrow': 7632, + 'day': 4061, + 'week': 4359, + 'month': 3676 + } +]; + +export const excelColumns = [ + { + 'title': '名称', + 'key': 'name' + }, + { + 'title': '展示', + 'key': 'show', + 'sortable': true, + filters: [ + { + label: '大于4000', + value: 1 + }, + { + label: '小于4000', + value: 2 + } + ], + filterMultiple: false, + filterMethod (value, row) { + if (value === 1) { + return row.show > 4000; + } else if (value === 2) { + return row.show < 4000; + } + } + }, + { + 'title': '唤醒', + 'key': 'weak', + 'sortable': true + }, + { + 'title': '登录', + 'key': 'signin', + 'sortable': true + }, + { + 'title': '点击', + 'key': 'click', + 'sortable': true + }, + { + 'title': '激活', + 'key': 'active', + 'sortable': true + }, + { + 'title': '30日留存', + 'key': 'day30', + 'sortable': true + }, + { + 'title': '月活跃', + 'key': 'month', + 'sortable': true + } +]; diff --git a/src/views/tables/dragable-table.vue b/src/views/tables/dragable-table.vue new file mode 100644 index 000000000..be569ffce --- /dev/null +++ b/src/views/tables/dragable-table.vue @@ -0,0 +1,197 @@ + + + ++ + ++ + + diff --git a/src/views/tables/editable-table.vue b/src/views/tables/editable-table.vue new file mode 100644 index 000000000..72c49464f --- /dev/null +++ b/src/views/tables/editable-table.vue @@ -0,0 +1,144 @@ + + + ++
++ + + ++ + + + ++
++ 表格1操作记录( 拖拽 ) + +
++++ 您正在拖拽表格1单元行... + ++ ++++ 拖拽第 {{ item.from }} 行表格到第 {{ item.to }} 行 +++
++ + + ++
++ 表格2操作记录( 点击和拖拽 ) + +
++++ 拖拽第 {{ table2.oldIndex + 1 }} 行表格到第 {{ table2.newIndex + 1 }} 行 + ++ ++++ {{ item }} +++ + + ++ ++ + + diff --git a/src/views/tables/exportable-table.vue b/src/views/tables/exportable-table.vue new file mode 100644 index 000000000..1f901cae9 --- /dev/null +++ b/src/views/tables/exportable-table.vue @@ -0,0 +1,124 @@ + + + ++
++ + + ++
++ 简单说明 + + 可编辑单元格可配置可编辑的列,可设置编辑整行的可编辑单元格,也可配置单个编辑可编辑单元格,也可两种形式同时可用。可配置单元格内编辑的图标显示方式。 +++ + + ++++ +
++ + + ++
++ 可编辑单元行 + +++ + + + ++
++ 可编辑单元格(鼠标移入显示编辑单元格按钮) + +++ +
++ + + ++
++ 单元行和单元格两种方式编辑(始终显示编辑单元格按钮) + +
++ + +
+ ++ ++ ++ + ++ ++ + + diff --git a/src/views/tables/searchable-table.vue b/src/views/tables/searchable-table.vue new file mode 100644 index 000000000..10c1f01b7 --- /dev/null +++ b/src/views/tables/searchable-table.vue @@ -0,0 +1,116 @@ + + + ++
++ ++
++ 导出表格数据到 .Csv 文件 + +
++ + +
+ + + ++++ ++ 选取行范围:++ - + + + 选取列范围:++ - + + + 输入文件名: + +++ +++
++ ++
++ 导出表格数据到 .Xls 文件 (Excel) + +
++ + +
+ + 输入文件名: + ++ + +++ + + diff --git a/src/views/tables/table-to-image.vue b/src/views/tables/table-to-image.vue new file mode 100644 index 000000000..5a01fc90c --- /dev/null +++ b/src/views/tables/table-to-image.vue @@ -0,0 +1,202 @@ + + + ++
++ + + ++
++ 一个条件搜索 + + +
++
++
+ + + ++
++ 多个条件搜索 + + + +
++
++
+ + + ++
++ 点击搜索进行搜索 + + + + +
++
++
++ + + diff --git a/td_icon.ico b/td_icon.ico new file mode 100644 index 000000000..97131e9ae Binary files /dev/null and b/td_icon.ico differ+
++ ++
++ 将表格数据连同样式一起以图片形式导出 + +
++ + +
+ + 输入文件名: + ++ +++ ++