├── .editorconfig ├── .gitignore ├── .npmignore ├── .prettierignore ├── .prettierrc ├── .stylelintrc ├── .travis.yml ├── LICENSE ├── README.md ├── angular.json ├── build.sh ├── karma.conf.js ├── lib ├── index.ts ├── public_api.ts ├── src │ ├── script.service.ts │ ├── umeditor.component.ts │ ├── umeditor.config.ts │ └── umeditor.spec.ts ├── test.ts ├── tsconfig.json ├── tsconfig.spec.json └── umeditor.module.ts ├── package.json ├── protractor.conf.js ├── rollup.config.js ├── scripts └── inline-template.js ├── src ├── app │ ├── app.component.ts │ ├── app.module.ts │ └── components │ │ ├── demo.component.html │ │ ├── demo.component.scss │ │ ├── demo.component.ts │ │ ├── dev.component.html │ │ ├── dev.component.scss │ │ └── dev.component.ts ├── assets │ ├── fork.png │ └── umeditor │ │ ├── dialogs │ │ ├── emotion │ │ │ ├── emotion.css │ │ │ ├── emotion.js │ │ │ └── images │ │ │ │ ├── 0.gif │ │ │ │ ├── bface.gif │ │ │ │ ├── cface.gif │ │ │ │ ├── fface.gif │ │ │ │ ├── jxface2.gif │ │ │ │ ├── neweditor-tab-bg.png │ │ │ │ ├── tface.gif │ │ │ │ ├── wface.gif │ │ │ │ └── yface.gif │ │ ├── formula │ │ │ ├── formula.css │ │ │ ├── formula.html │ │ │ ├── formula.js │ │ │ └── images │ │ │ │ └── formula.png │ │ ├── image │ │ │ ├── image.css │ │ │ ├── image.js │ │ │ └── images │ │ │ │ ├── close.png │ │ │ │ ├── upload1.png │ │ │ │ └── upload2.png │ │ ├── link │ │ │ └── link.js │ │ ├── map │ │ │ ├── map.html │ │ │ └── map.js │ │ └── video │ │ │ ├── images │ │ │ ├── center_focus.jpg │ │ │ ├── left_focus.jpg │ │ │ ├── none_focus.jpg │ │ │ └── right_focus.jpg │ │ │ ├── video.css │ │ │ └── video.js │ │ ├── index.html │ │ ├── lang │ │ ├── en │ │ │ ├── en.js │ │ │ └── images │ │ │ │ ├── addimage.png │ │ │ │ ├── alldeletebtnhoverskin.png │ │ │ │ ├── alldeletebtnupskin.png │ │ │ │ ├── background.png │ │ │ │ ├── button.png │ │ │ │ ├── copy.png │ │ │ │ ├── deletedisable.png │ │ │ │ ├── deleteenable.png │ │ │ │ ├── imglabel.png │ │ │ │ ├── listbackground.png │ │ │ │ ├── localimage.png │ │ │ │ ├── music.png │ │ │ │ ├── rotateleftdisable.png │ │ │ │ ├── rotateleftenable.png │ │ │ │ ├── rotaterightdisable.png │ │ │ │ ├── rotaterightenable.png │ │ │ │ └── upload.png │ │ └── zh-cn │ │ │ ├── images │ │ │ ├── copy.png │ │ │ ├── imglabel.png │ │ │ ├── localimage.png │ │ │ ├── music.png │ │ │ └── upload.png │ │ │ └── zh-cn.js │ │ ├── php │ │ ├── Uploader.class.php │ │ ├── getContent.php │ │ └── imageUp.php │ │ ├── themes │ │ └── default │ │ │ ├── css │ │ │ ├── umeditor.css │ │ │ └── umeditor.min.css │ │ │ └── images │ │ │ ├── caret.png │ │ │ ├── close.png │ │ │ ├── icons.gif │ │ │ ├── icons.png │ │ │ ├── ok.gif │ │ │ ├── pop-bg.png │ │ │ ├── spacer.gif │ │ │ └── videologo.gif │ │ ├── third-party │ │ ├── jquery.min.js │ │ ├── mathquill │ │ │ ├── font │ │ │ │ ├── Symbola.eot │ │ │ │ ├── Symbola.otf │ │ │ │ ├── Symbola.svg │ │ │ │ ├── Symbola.ttf │ │ │ │ ├── Symbola.woff │ │ │ │ └── stixgeneral-bundle │ │ │ │ │ ├── STIXFontLicense2010.txt │ │ │ │ │ ├── stixgeneral-webfont.eot │ │ │ │ │ ├── stixgeneral-webfont.svg │ │ │ │ │ ├── stixgeneral-webfont.ttf │ │ │ │ │ ├── stixgeneral-webfont.woff │ │ │ │ │ ├── stixgeneralbol-webfont.eot │ │ │ │ │ ├── stixgeneralbol-webfont.svg │ │ │ │ │ ├── stixgeneralbol-webfont.ttf │ │ │ │ │ ├── stixgeneralbol-webfont.woff │ │ │ │ │ ├── stixgeneralbolita-webfont.eot │ │ │ │ │ ├── stixgeneralbolita-webfont.svg │ │ │ │ │ ├── stixgeneralbolita-webfont.ttf │ │ │ │ │ ├── stixgeneralbolita-webfont.woff │ │ │ │ │ ├── stixgeneralitalic-webfont.eot │ │ │ │ │ ├── stixgeneralitalic-webfont.svg │ │ │ │ │ ├── stixgeneralitalic-webfont.ttf │ │ │ │ │ └── stixgeneralitalic-webfont.woff │ │ │ ├── mathquill.css │ │ │ ├── mathquill.js │ │ │ └── mathquill.min.js │ │ └── template.min.js │ │ ├── umeditor.config.js │ │ ├── umeditor.js │ │ └── umeditor.min.js ├── browserslist ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css ├── tsconfig.json └── typings.d.ts ├── tsconfig-build.json ├── tsconfig.json └── tslint.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 4 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 3 | /node_modules 4 | npm-debug.log 5 | package-lock.json 6 | yarn.lock 7 | 8 | # WebStorm 9 | .idea 10 | .vscode 11 | .lib 12 | 13 | # ignore build and dist for now 14 | /dist 15 | /tmp 16 | /out-tsc 17 | /__gen_lib 18 | /publish-es5 19 | /publish-es2015 20 | /publish 21 | /coverage 22 | 23 | # ignore inline compiling 24 | /logs 25 | 26 | # AoT generated files 27 | factories 28 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Commenting this out is preferred by some people, see 24 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 25 | node_modules 26 | 27 | # Users Environment Variables 28 | .lock-wscript 29 | .tsdrc 30 | 31 | #IntelliJ configuration files 32 | .idea 33 | 34 | dist 35 | dev 36 | docs 37 | lib 38 | test 39 | tmp 40 | 41 | Thumbs.db 42 | .DS_Store 43 | 44 | *.ts 45 | !*.d.ts 46 | 47 | src/app/example* 48 | src/public 49 | typings 50 | *_spec.* 51 | CONTRIBUTING.md 52 | gulpfile.ts 53 | favicon.ico 54 | karma-shim.js 55 | karma.conf.js 56 | make.js 57 | protractor.conf.js 58 | test-main.js 59 | tsconfig.json 60 | tslint.json 61 | typedoc.json 62 | typings.json 63 | webpack.config.js 64 | *.yml 65 | .jshintrc 66 | .editorconfig 67 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/.prettierignore -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "singleQuote": true, 4 | "trailingComma": "all" 5 | } 6 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": { 3 | "stylelint-config-standard", 4 | "./node_modules/prettier-stylelint/config.js" 5 | }, 6 | "rules": { 7 | "comment-empty-line-before": null, 8 | "declaration-empty-line-before": null, 9 | "function-comma-newline-after": null, 10 | "function-name-case": null, 11 | "function-parentheses-newline-inside": null, 12 | "function-max-empty-lines": null, 13 | "function-whitespace-after": null, 14 | "indentation": null, 15 | "number-leading-zero": null, 16 | "number-no-trailing-zeros": null, 17 | "rule-empty-line-before": null, 18 | "selector-combinator-space-after": null, 19 | "selector-list-comma-newline-after": null, 20 | "selector-pseudo-element-colon-notation": null, 21 | "unit-no-unknown": null, 22 | "value-list-max-empty-lines": null, 23 | "selector-type-no-unknown": null, 24 | "selector-pseudo-element-no-unknown": [ 25 | true, 26 | { 27 | "ignorePseudoElements": [ 28 | "ng-deep" 29 | ] 30 | } 31 | ], 32 | "no-descending-specificity": null 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: node_js 3 | node_js: 4 | - "8.11.0" 5 | 6 | env: 7 | - TASK=lint 8 | - TASK=build 9 | - TASK=site:build 10 | 11 | addons: 12 | apt: 13 | sources: 14 | - google-chrome 15 | packages: 16 | - google-chrome-stable 17 | - google-chrome-beta 18 | 19 | git: 20 | depth: 1 21 | 22 | before_install: 23 | - export CHROME_BIN=chromium-browser 24 | - export DISPLAY=:99.0 25 | - sh -e /etc/init.d/xvfb start 26 | 27 | script: 28 | - npm run $TASK 29 | - | 30 | if [ "$TASK" = "test" ]; then 31 | cat ./coverage/lcov.info | ./node_modules/.bin/codecov 32 | fi 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present 卡色 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ngx-umeditor 2 | Angular for Baidu UMeditor([UEditor](https://github.com/cipchk/ngx-ueditor)) 3 | 4 | [![NPM version](https://img.shields.io/npm/v/ngx-umeditor.svg)](https://www.npmjs.com/package/ngx-umeditor) 5 | [![Build Status](https://travis-ci.org/cipchk/ngx-umeditor.svg?branch=master)](https://travis-ci.org/cipchk/ngx-umeditor) 6 | 7 | 8 | ## Demo 9 | 10 | [Live Demo](https://cipchk.github.io/ngx-umeditor/) 11 | 12 | ## 特性 13 | 14 | + 懒加载 umeditor.min.js 文件。 15 | + 支持umeditor事件监听与移除 16 | + 支持语言切换 17 | + 支持umeditor实例对象直接访问。 18 | 19 | ## 使用 20 | 21 | ### 1、安装 22 | 23 | ``` 24 | npm install ngx-umeditor --save 25 | ``` 26 | 27 | 把 `UMeditorModule` 模块导入到你项目中。 28 | 29 | ```typescript 30 | import { UMeditorModule } from 'ngx-umeditor'; 31 | 32 | @NgModule({ 33 | imports: [BrowserModule, UMeditorModule.forRoot() ], 34 | declarations: [AppComponent], 35 | bootstrap: [AppComponent] 36 | }) 37 | export class AppModule { } 38 | ``` 39 | 40 | ### 2、使用 41 | 42 | ```html 43 | 49 | ``` 50 | 51 | | 名称 | 类型 | 默认值 | 描述 | 52 | | ------- | ------------- | ----- | ----- | 53 | | config | Object | | 前端配置项说明,[见官网](http://fex.baidu.com/umeditor/#start-config) | 54 | | path | string | ./assets/umeditor/ | umeditor代码根目录路径,以 `/` 结尾。 | 55 | | loadingTip | string | 加载中... | 初始化提示文本。 | 56 | | onReady | Function | | 编辑器准备就绪后会触发该事件 | 57 | | onDestroy | Function | | **编辑器组件销毁**后会触发该事件 | 58 | 59 | ### 3、关于懒加载 60 | 61 | 懒加载在未到 `wdinow.UM` 时会启动,如果你在 `index.html` 已经使用 `` 加载过,懒加载流程将会失效。 62 | 63 | **加载语言注意点** 64 | 65 | 懒加载会自动识别并引用,否则,需要自行在 `` 加入语言版本脚本。 66 | 67 | ## 访问umeditor实例对象 68 | 69 | 首先,需要给组件定义一下模板变量: 70 | 71 | ```html 72 | 73 | ``` 74 | 75 | 使用 `@ViewChild` 访问组件,并使用 `this.full.Instance` 访问umeditor实例对象。 76 | 77 | ```typescript 78 | export class DemoComponent { 79 | @ViewChild('full') full: UeditorComponent; 80 | constructor(private el: ElementRef) {} 81 | 82 | getAllHtml() { 83 | // 通过 `this.full.Instance` 访问umeditor实例对象 84 | alert(this.full.Instance.getAllHtml()) 85 | } 86 | } 87 | ``` 88 | 89 | ## 事件 90 | 91 | 虽说上节也可以直接注册umeditor事件,但当组件被销毁时可能会引发内存泄露。所以**不建议直接在umeditor实例中这么做**。组件本身提供 `addListener` 和 `removeListener` 来帮你处理。 92 | 93 | ```typescript 94 | // 事件监听 95 | this.full.addListener('focus', () => { 96 | this.focus = `fire focus in ${new Date().getTime()}`; 97 | }); 98 | // 事件移除 99 | this.full.removeListener('focus'); 100 | ``` 101 | 102 | ## 表单非空校验 103 | 104 | 组件加入 `required` 当编辑器为空时会处于 `ng-invalid` 状态,具体体验见[Live Demo](https://cipchk.github.io/ngx-umeditor/)。 105 | 106 | ## 组件接口 107 | 108 | ```typescript 109 | interface UMeditorComponent { 110 | /** 111 | * 获取UM实例 112 | * 113 | * @readonly 114 | */ 115 | get Instance(): any; 116 | 117 | /** 118 | * 设置编辑器语言 119 | * 120 | * @param {('zh-cn' | 'en')} lang 121 | */ 122 | setLanguage(lang: 'zh-cn' | 'en') {} 123 | 124 | /** 125 | * 添加编辑器事件 126 | */ 127 | addListener(eventName: 'destroy' | 'reset' | 'focus' | 'langReady' | 'beforeExecCommand' | 'afterExecCommand' | 'firstBeforeExecCommand' | 'beforeGetContent' | 'afterGetContent' | 'getAllHtml' | 'beforeSetContent' | 'afterSetContent' | 'selectionchange' | 'beforeSelectionChange' | 'afterSelectionChange', 128 | fn: Function): void {} 129 | 130 | /** 131 | * 移除编辑器事件 132 | * 133 | * @param {('destroy' | 'reset' | 'focus' | 'langReady' | 'beforeExecCommand' | 'afterExecCommand' | 'firstBeforeExecCommand' | 'beforeGetContent' | 'afterGetContent' | 'getAllHtml' | 'beforeSetContent' | 'afterSetContent' | 'selectionchange' | 'beforeSelectionChange' | 'afterSelectionChange')} eventName 134 | */ 135 | removeListener(eventName: 'destroy' | 'reset' | 'focus' | 'langReady' | 'beforeExecCommand' | 'afterExecCommand' | 'firstBeforeExecCommand' | 'beforeGetContent' | 'afterGetContent' | 'getAllHtml' | 'beforeSetContent' | 'afterSetContent' | 'selectionchange' | 'beforeSelectionChange' | 'afterSelectionChange'): void {} 136 | } 137 | ``` 138 | 139 | ## Troubleshooting 140 | 141 | Please follow this guidelines when reporting bugs and feature requests: 142 | 143 | 1. Use [GitHub Issues](https://github.com/cipchk/ngx-umeditor/issues) board to report bugs and feature requests (not our email address) 144 | 2. Please **always** write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it. 145 | 146 | Thanks for understanding! 147 | 148 | ### License 149 | 150 | The MIT License (see the [LICENSE](https://github.com/cipchk/ngx-umeditor/blob/master/LICENSE) file for the full text) 151 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ngx-umeditor": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "architect": { 11 | "build": { 12 | "builder": "@angular-devkit/build-angular:browser", 13 | "options": { 14 | "outputPath": "dist", 15 | "index": "src/index.html", 16 | "main": "src/main.ts", 17 | "tsConfig": "src/tsconfig.json", 18 | "polyfills": "src/polyfills.ts", 19 | "assets": ["src/assets"], 20 | "styles": ["src/styles.css"], 21 | "scripts": [] 22 | }, 23 | "configurations": { 24 | "production": { 25 | "optimization": true, 26 | "outputHashing": "all", 27 | "sourceMap": false, 28 | "extractCss": true, 29 | "namedChunks": false, 30 | "aot": true, 31 | "extractLicenses": true, 32 | "vendorChunk": false, 33 | "buildOptimizer": true, 34 | "fileReplacements": [ 35 | { 36 | "replace": "src/environments/environment.ts", 37 | "with": "src/environments/environment.prod.ts" 38 | } 39 | ] 40 | } 41 | } 42 | }, 43 | "serve": { 44 | "builder": "@angular-devkit/build-angular:dev-server", 45 | "options": { 46 | "browserTarget": "ngx-umeditor:build" 47 | }, 48 | "configurations": { 49 | "production": { 50 | "browserTarget": "ngx-umeditor:build:production" 51 | } 52 | } 53 | }, 54 | "extract-i18n": { 55 | "builder": "@angular-devkit/build-angular:extract-i18n", 56 | "options": { 57 | "browserTarget": "ngx-umeditor:build" 58 | } 59 | }, 60 | "test": { 61 | "builder": "@angular-devkit/build-angular:karma", 62 | "options": { 63 | "main": "lib/test.ts", 64 | "tsConfig": "lib/tsconfig.spec.json", 65 | "karmaConfig": "karma.conf.js", 66 | "polyfills": "src/polyfills.ts", 67 | "scripts": [], 68 | "styles": [], 69 | "assets": ["src/assets"] 70 | } 71 | }, 72 | "lint": { 73 | "builder": "@angular-devkit/build-angular:tslint", 74 | "options": { 75 | "tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"], 76 | "exclude": ["**/node_modules/**"] 77 | } 78 | } 79 | } 80 | }, 81 | "ngx-umeditor-e2e": { 82 | "root": "", 83 | "sourceRoot": "", 84 | "projectType": "application", 85 | "architect": { 86 | "e2e": { 87 | "builder": "@angular-devkit/build-angular:protractor", 88 | "options": { 89 | "protractorConfig": "./protractor.conf.js", 90 | "devServerTarget": "ngx-umeditor:serve" 91 | } 92 | }, 93 | "lint": { 94 | "builder": "@angular-devkit/build-angular:tslint", 95 | "options": { 96 | "tsConfig": ["e2e/tsconfig.e2e.json"], 97 | "exclude": ["**/node_modules/**"] 98 | } 99 | } 100 | } 101 | } 102 | }, 103 | "defaultProject": "ngx-umeditor", 104 | "schematics": { 105 | "@schematics/angular:component": { 106 | "prefix": "app", 107 | "styleext": "css" 108 | }, 109 | "@schematics/angular:directive": { 110 | "prefix": "app" 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -u -e -o pipefail 4 | 5 | readonly currentDir=$(cd $(dirname $0); pwd) 6 | cd ${currentDir} 7 | 8 | rm -rf publish 9 | rm -rf __gen_lib 10 | rm -rf publish-es2015 11 | cp -r lib __gen_lib 12 | node ./scripts/inline-template.js 13 | 14 | echo 'Compiling to es2015 via Angular compiler' 15 | $(npm bin)/ngc -p tsconfig-build.json -t es2015 --outDir publish-es2015/src 16 | 17 | echo 'Bundling to es module of es2015' 18 | export ROLLUP_TARGET=esm 19 | $(npm bin)/rollup -c rollup.config.js -f es -i publish-es2015/src/index.js -o publish-es2015/esm2015/umeditor.js 20 | 21 | echo 'Compiling to es5 via Angular compiler' 22 | $(npm bin)/ngc -p tsconfig-build.json -t es5 --outDir publish-es5/src 23 | 24 | echo 'Bundling to es module of es5' 25 | export ROLLUP_TARGET=esm 26 | $(npm bin)/rollup -c rollup.config.js -f es -i publish-es5/src/index.js -o publish-es5/esm5/umeditor.js 27 | 28 | echo 'Bundling to umd module of es5' 29 | export ROLLUP_TARGET=umd 30 | $(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/umeditor.js -o publish-es5/bundles/umeditor.umd.js 31 | 32 | echo 'Bundling to minified umd module of es5' 33 | export ROLLUP_TARGET=mumd 34 | $(npm bin)/rollup -c rollup.config.js -f umd -i publish-es5/esm5/umeditor.js -o publish-es5/bundles/umeditor.umd.min.js 35 | 36 | echo 'Unifying publish folder' 37 | mv publish-es5 publish 38 | mv publish-es2015/esm2015 publish/esm2015 39 | rm -rf publish-es2015 40 | 41 | echo 'Cleaning up temporary files' 42 | rm -rf __gen_lib 43 | rm -rf publish/src/*.js 44 | rm -rf publish/src/**/*.js 45 | 46 | echo 'Normalizing entry files' 47 | sed -e "s/from '.\//from '.\/src\//g" publish/src/index.d.ts > publish/umeditor.d.ts 48 | sed -e "s/\":\".\//\":\".\/src\//g" publish/src/index.metadata.json > publish/umeditor.metadata.json 49 | rm publish/src/index.d.ts publish/src/index.metadata.json 50 | 51 | echo 'Copying package.json' 52 | cp package.json publish/package.json 53 | echo 'Copying README.md' 54 | cp README.md publish/README.md 55 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './public_api'; 2 | -------------------------------------------------------------------------------- /lib/public_api.ts: -------------------------------------------------------------------------------- 1 | export { UMeditorComponent } from './src/umeditor.component'; 2 | export { UMeditorConfig } from './src/umeditor.config'; 3 | export { UMeditorModule } from './umeditor.module'; 4 | -------------------------------------------------------------------------------- /lib/src/script.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Subject } from 'rxjs'; 3 | 4 | declare const window: any; 5 | declare const document: any; 6 | 7 | @Injectable() 8 | export class ScriptService { 9 | private loaded = false; 10 | private list: any = {}; 11 | private emitter: Subject = new Subject(); 12 | 13 | getChangeEmitter() { 14 | return this.emitter; 15 | } 16 | 17 | load(path: string, debug?: boolean) { 18 | if (this.loaded) return this; 19 | 20 | this.loaded = true; 21 | 22 | if (!path.endsWith('/')) path += '/'; 23 | // 优先加载依赖库 24 | this.loadLib(path).then(() => { 25 | const promises: Promise[] = []; 26 | 27 | promises.push( 28 | this.loadCss(`${path}themes/default/css/umeditor.min.css`) 29 | ); 30 | 31 | [ 32 | `${path}umeditor.config.js`, 33 | debug === true 34 | ? `${path}umeditor.js` 35 | : `${path}umeditor.all.min.js` 36 | ].forEach(script => promises.push(this.loadScript(script))); 37 | 38 | Promise.all(promises).then(res => { 39 | this.emitter.next(true); 40 | }); 41 | }); 42 | 43 | return this; 44 | } 45 | 46 | loadLib(path: string): Promise { 47 | return new Promise((resolve, reject) => { 48 | const promises: Promise[] = []; 49 | const jss: string[] = []; 50 | if (!window.jQuery) jss.push(`${path}third-party/jquery.min.js`); 51 | if (!window.etpl) jss.push(`${path}third-party/template.min.js`); 52 | 53 | jss.forEach(script => promises.push(this.loadScript(script))); 54 | 55 | Promise.all(promises).then(res => { 56 | resolve(); 57 | }); 58 | }); 59 | } 60 | 61 | loadScript(path: string): Promise { 62 | return new Promise((resolve, reject) => { 63 | if (this.list[path] === true) { 64 | resolve({ 65 | path: path, 66 | loaded: true, 67 | status: 'Loaded' 68 | }); 69 | return; 70 | } 71 | 72 | this.list[path] = true; 73 | 74 | const node = document.createElement('script'); 75 | node.type = 'text/javascript'; 76 | node.src = path; 77 | node.charset = 'utf-8'; 78 | if (node.readyState) { 79 | // IE 80 | node.onreadystatechange = () => { 81 | if ( 82 | node.readyState === 'loaded' || 83 | node.readyState === 'complete' 84 | ) { 85 | node.onreadystatechange = null; 86 | resolve({ 87 | path: path, 88 | loaded: true, 89 | status: 'Loaded' 90 | }); 91 | } 92 | }; 93 | } else { 94 | node.onload = () => { 95 | resolve({ 96 | path: path, 97 | loaded: true, 98 | status: 'Loaded' 99 | }); 100 | }; 101 | } 102 | node.onerror = (error: any) => 103 | resolve({ 104 | path: path, 105 | loaded: false, 106 | status: 'Loaded' 107 | }); 108 | document.getElementsByTagName('head')[0].appendChild(node); 109 | }); 110 | } 111 | 112 | loadCss(path: string): Promise { 113 | return new Promise((resolve, reject) => { 114 | if (this.list[path] === true) { 115 | resolve({ 116 | path: path, 117 | loaded: true, 118 | status: 'Loaded' 119 | }); 120 | return; 121 | } 122 | 123 | this.list[path] = true; 124 | 125 | const node = document.createElement('link'); 126 | node.rel = 'stylesheet'; 127 | node.type = 'text/css'; 128 | node.href = path; 129 | document.getElementsByTagName('head')[0].appendChild(node); 130 | resolve({ 131 | path: path, 132 | loaded: true, 133 | status: 'Loaded' 134 | }); 135 | }); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /lib/src/umeditor.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | Input, 4 | forwardRef, 5 | ElementRef, 6 | OnDestroy, 7 | EventEmitter, 8 | Output, 9 | NgZone, 10 | OnInit, 11 | ChangeDetectionStrategy, 12 | ChangeDetectorRef, 13 | AfterViewInit, 14 | SimpleChanges, 15 | OnChanges, 16 | } from '@angular/core'; 17 | import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; 18 | 19 | import { ScriptService } from './script.service'; 20 | import { UMeditorConfig } from './umeditor.config'; 21 | 22 | declare const window: any; 23 | declare const UM: any; 24 | 25 | export type EventTypes = 26 | | 'destroy' 27 | | 'reset' 28 | | 'focus' 29 | | 'langReady' 30 | | 'beforeExecCommand' 31 | | 'afterExecCommand' 32 | | 'firstBeforeExecCommand' 33 | | 'beforeGetContent' 34 | | 'afterGetContent' 35 | | 'getAllHtml' 36 | | 'beforeSetContent' 37 | | 'afterSetContent' 38 | | 'selectionchange' 39 | | 'beforeSelectionChange' 40 | | 'afterSelectionChange'; 41 | 42 | @Component({ 43 | // tslint:disable-next-line:component-selector 44 | selector: 'umeditor', 45 | template: ` 46 | 47 |

{{ loadingTip }}

48 | `, 49 | preserveWhitespaces: false, 50 | styles: [ 51 | ` 52 | :host { 53 | line-height: initial; 54 | } 55 | :host .umeditor-textarea { 56 | display: none; 57 | width: 100%; 58 | } 59 | `, 60 | ], 61 | providers: [ 62 | { 63 | provide: NG_VALUE_ACCESSOR, 64 | useExisting: forwardRef(() => UMeditorComponent), 65 | multi: true, 66 | }, 67 | ], 68 | changeDetection: ChangeDetectionStrategy.OnPush, 69 | }) 70 | export class UMeditorComponent 71 | implements 72 | OnInit, 73 | AfterViewInit, 74 | OnChanges, 75 | OnDestroy, 76 | ControlValueAccessor { 77 | private instance: any; 78 | private value: string; 79 | private inited = false; 80 | private events: any = {}; 81 | 82 | private onChange: (value: string) => void; 83 | private onTouched: () => void; 84 | 85 | loading = true; 86 | id = `_umeditor-${Math.random().toString(36).substring(2)}`; 87 | 88 | @Input() path: string; 89 | @Input() config: any; 90 | @Input() loadingTip = '加载中...'; 91 | 92 | /** 延迟初始化 */ 93 | @Input() delay = 50; 94 | 95 | @Output() onReady = new EventEmitter(); 96 | @Output() onDestroy = new EventEmitter(); 97 | 98 | constructor( 99 | private el: ElementRef, 100 | private zone: NgZone, 101 | private ss: ScriptService, 102 | private cd: ChangeDetectorRef, 103 | cog: UMeditorConfig, 104 | ) { 105 | Object.assign(this, { ...new UMeditorConfig(), cog }); 106 | } 107 | 108 | ngOnInit() { 109 | this.inited = true; 110 | } 111 | 112 | ngAfterViewInit(): void { 113 | // 已经存在对象无须进入懒加载模式 114 | if (window.UM) { 115 | this.initDelay(); 116 | return; 117 | } 118 | 119 | this.ss 120 | .load(this.path, true) 121 | .getChangeEmitter() 122 | .subscribe((res) => this.initDelay()); 123 | } 124 | 125 | ngOnChanges(changes: SimpleChanges): void { 126 | if (this.inited && changes.config) { 127 | this.destroy(); 128 | this.initDelay(); 129 | } 130 | } 131 | 132 | private initDelay() { 133 | setTimeout(() => this.init(), this.delay); 134 | } 135 | 136 | private init(options?: any) { 137 | if (!window.UM) { 138 | throw new Error('uedito js文件加载失败'); 139 | } 140 | 141 | if (this.instance) { 142 | return; 143 | } 144 | 145 | this.zone.runOutsideAngular(() => { 146 | window.UMEDITOR_CONFIG.UMEDITOR_HOME_URL = this.path; 147 | const umeditor = UM.getEditor( 148 | this.id, 149 | Object.assign( 150 | { 151 | UMEDITOR_HOME_URL: this.path, 152 | }, 153 | this.config, 154 | options, 155 | ), 156 | ); 157 | umeditor.ready(() => { 158 | this.instance = umeditor; 159 | if (this.value) this.instance.setContent(this.value); 160 | this.zone.run(() => this.onReady.emit(this)); 161 | }); 162 | 163 | umeditor.addListener('contentChange', () => { 164 | this.value = umeditor.getContent(); 165 | this.zone.run(() => this.onChange(this.value)); 166 | }); 167 | }); 168 | this.loading = false; 169 | this.cd.detectChanges(); 170 | } 171 | 172 | private destroy() { 173 | // fixed: 由于组件ngOnDestroy会先清除DOM,倒置instance为空,因此从内存中获取实例 174 | this.instance = UM.getEditor(this.id); 175 | if (this.instance) { 176 | Object.keys(this.events).forEach((key) => { 177 | this.instance.removeListener(key, this.events[key]); 178 | }); 179 | this.instance.removeListener('contentChange'); 180 | this.instance.destroy(); 181 | this.instance = null; 182 | } 183 | this.onDestroy.emit(this); 184 | } 185 | 186 | /** 187 | * 获取UE实例 188 | */ 189 | get Instance(): any { 190 | return this.instance; 191 | } 192 | 193 | /** 194 | * 设置编辑器语言 195 | */ 196 | setLanguage(lang: 'zh-cn' | 'en') { 197 | this.ss 198 | .loadScript(`${this.path}/lang/${lang}/${lang}.js`) 199 | .then((res) => { 200 | this.destroy(); 201 | 202 | // 清空语言 203 | if (!UM._bak_I18N) { 204 | UM._bak_I18N = UM.I18N; 205 | } 206 | UM.I18N = {}; 207 | UM.I18N[lang] = UM._bak_I18N[lang]; 208 | 209 | this.initDelay(); 210 | }); 211 | } 212 | 213 | /** 214 | * 添加编辑器事件 215 | */ 216 | addListener(eventName: EventTypes, fn: Function): void { 217 | if (this.events[eventName]) { 218 | return; 219 | } 220 | this.events[eventName] = fn; 221 | this.instance.addListener(eventName, fn); 222 | } 223 | 224 | /** 225 | * 移除编辑器事件 226 | */ 227 | removeListener(eventName: EventTypes): void { 228 | if (!this.events[eventName]) { 229 | return; 230 | } 231 | this.instance.removeListener(eventName, this.events[eventName]); 232 | delete this.events[eventName]; 233 | } 234 | 235 | ngOnDestroy() { 236 | this.destroy(); 237 | } 238 | 239 | writeValue(value: string): void { 240 | this.value = value; 241 | if (this.value && this.instance) { 242 | this.instance.setContent(this.value); 243 | } 244 | } 245 | 246 | public registerOnChange(fn: (_: any) => {}): void { 247 | this.onChange = fn; 248 | } 249 | public registerOnTouched(fn: () => {}): void { 250 | this.onTouched = fn; 251 | } 252 | 253 | setDisabledState(isDisabled: boolean): void { 254 | if (isDisabled) { 255 | this.instance.setDisabled(); 256 | } else { 257 | this.instance.setEnabled(); 258 | } 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /lib/src/umeditor.config.ts: -------------------------------------------------------------------------------- 1 | export class UMeditorConfig { 2 | /** 3 | * 默认配置项 4 | */ 5 | config?: any; 6 | 7 | /** 8 | * 指定umeditor.js路径,默认:`./assets/umeditor/` 9 | */ 10 | path? = './assets/umeditor/'; 11 | } 12 | -------------------------------------------------------------------------------- /lib/src/umeditor.spec.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 3 | 4 | import { UMeditorModule } from '../index'; 5 | 6 | const html = ``; 7 | 8 | describe('Component: ngx-umeditor', () => { 9 | let fixture: ComponentFixture; 10 | let context: TestNGComponent; 11 | 12 | beforeEach(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [TestNGComponent], 15 | imports: [UMeditorModule] 16 | }); 17 | TestBed.overrideComponent(TestNGComponent, {set: {template: html}}); 18 | fixture = TestBed.createComponent(TestNGComponent); 19 | context = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('fixture should not be null', () => { 24 | expect(fixture).not.toBeNull(); 25 | }); 26 | }); 27 | 28 | @Component({ 29 | selector: 'app-umeditor-test', 30 | template: '' 31 | }) 32 | class TestNGComponent { 33 | } 34 | -------------------------------------------------------------------------------- /lib/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting, 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting(), 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "../dist", 4 | "target": "es5", 5 | "module": "es2015", 6 | "moduleResolution": "node", 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "sourceMap": true, 10 | "inlineSources": true, 11 | "noImplicitAny": true, 12 | "declaration": true, 13 | "skipLibCheck": false, 14 | "stripInternal": true, 15 | "allowSyntheticDefaultImports": true, 16 | "noUnusedLocals": false, 17 | "noUnusedParameters": false, 18 | "lib": ["dom", "es6"], 19 | "types": ["jasmine"], 20 | "typeRoots": ["../node_modules/@types"] 21 | }, 22 | "exclude": ["node_modules"], 23 | "files": ["../scripts/typings.d.ts", "./index.ts"], 24 | "angularCompilerOptions": { 25 | "genDir": "../temp/factories", 26 | "strictMetadataEmit": true, 27 | "skipTemplateCodegen": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "../dist/out-tsc", 5 | "baseUrl": ".", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "sourceMap": true, 9 | "declaration": false, 10 | "moduleResolution": "node", 11 | "emitDecoratorMetadata": true, 12 | "experimentalDecorators": true, 13 | "typeRoots": ["../node_modules/@types"], 14 | "types": ["jasmine", "webpack"], 15 | "lib": ["es2016", "dom"] 16 | }, 17 | "include": [ 18 | "**/*.spec.ts" 19 | ], 20 | "exclude": ["../src", "../node_modules"] 21 | } 22 | -------------------------------------------------------------------------------- /lib/umeditor.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule, ModuleWithProviders } from '@angular/core'; 3 | 4 | import { ScriptService } from './src/script.service'; 5 | import { UMeditorConfig } from './src/umeditor.config'; 6 | import { UMeditorComponent } from './src/umeditor.component'; 7 | 8 | @NgModule({ 9 | imports: [CommonModule], 10 | providers: [ ScriptService ], 11 | declarations: [UMeditorComponent], 12 | exports: [UMeditorComponent] 13 | }) 14 | export class UMeditorModule { 15 | static forRoot(config?: UMeditorConfig): ModuleWithProviders { 16 | return { 17 | ngModule: UMeditorModule, 18 | providers: [ 19 | { provide: UMeditorConfig, useValue: config } 20 | ] 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ngx-umeditor", 3 | "version": "2.0.2", 4 | "main": "./bundles/umeditor.umd.js", 5 | "module": "./esm5/umeditor.js", 6 | "es2015": "./esm2015/umeditor.js", 7 | "typings": "./umeditor.d.ts", 8 | "description": "Angular for Baidu UMeditor.", 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/cipchk/ngx-umeditor.git" 12 | }, 13 | "keywords": [ 14 | "ngx-umeditor", 15 | "ng2-umeditor", 16 | "umeditor", 17 | "angular", 18 | "angular component" 19 | ], 20 | "author": "cipchk ", 21 | "license": "MIT", 22 | "bugs": { 23 | "url": "https://github.com/cipchk/ngx-umeditor/issues" 24 | }, 25 | "homepage": "https://github.com/cipchk/ngx-umeditor#readme", 26 | "scripts": { 27 | "analyze": "ng build --prod --build-optimizer --stats-json", 28 | "lint": "tslint -p tsconfig.json -c tslint.json 'lib/*/*.ts'", 29 | "test": "ng test --code-coverage", 30 | "site:build": "ng build --prod --build-optimizer", 31 | "site:gh": "ng build --prod --build-optimizer --base-href /ngx-umeditor/ && gh-pages -d ./dist", 32 | "build": "bash ./build.sh", 33 | "release:next": "bash ./build.sh && cd publish && npm publish --access public --tag next", 34 | "release": "bash ./build.sh && cd publish && npm publish --access public" 35 | }, 36 | "devDependencies": { 37 | "@angular/animations": "^6.0.0", 38 | "@angular/common": "^6.0.0", 39 | "@angular/compiler": "^6.0.0", 40 | "@angular/core": "^6.0.0", 41 | "@angular/forms": "^6.0.0", 42 | "@angular/http": "^6.0.0", 43 | "@angular/platform-browser": "^6.0.0", 44 | "@angular/platform-browser-dynamic": "^6.0.0", 45 | "@angular/router": "^6.0.0", 46 | "core-js": "^2.5.4", 47 | "rxjs": "^6.0.0", 48 | "zone.js": "^0.8.26", 49 | "ngx-highlight-js": "^2.0.0", 50 | "@angular-devkit/build-angular": "^0.8.0", 51 | "@angular/cli": "^6.0.0", 52 | "@angular/compiler-cli": "^6.0.0", 53 | "@angular/language-service": "^6.0.0", 54 | "@types/jasmine": "~2.8.6", 55 | "@types/jasminewd2": "~2.0.3", 56 | "@types/node": "~8.9.4", 57 | "codecov": "^3.0.0", 58 | "codelyzer": "~4.2.1", 59 | "jasmine-core": "~2.99.1", 60 | "jasmine-spec-reporter": "~4.2.1", 61 | "karma": "~1.7.1", 62 | "karma-chrome-launcher": "~2.2.0", 63 | "karma-coverage-istanbul-reporter": "~1.4.2", 64 | "karma-jasmine": "~1.1.1", 65 | "karma-jasmine-html-reporter": "^0.2.2", 66 | "protractor": "~5.3.0", 67 | "rollup": "^0.49.2", 68 | "rollup-plugin-node-resolve": "^3.0.0", 69 | "rollup-plugin-replace": "^2.0.0", 70 | "rollup-plugin-sourcemaps": "^0.4.2", 71 | "rollup-plugin-uglify": "^2.0.1", 72 | "ts-node": "~5.0.1", 73 | "tslint": "~5.9.1", 74 | "typescript": "~2.9.0" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | beforeLaunch: function() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | }, 27 | onPrepare() { 28 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from "rollup-plugin-node-resolve"; 2 | import uglify from "rollup-plugin-uglify"; 3 | import sourcemaps from "rollup-plugin-sourcemaps"; 4 | 5 | const target = process.env.ROLLUP_TARGET || "esm"; 6 | 7 | let globals = { 8 | "@angular/animations": "ng.animations", 9 | "@angular/core": "ng.core", 10 | "@angular/common": "ng.common", 11 | "@angular/forms": "ng.forms", 12 | "@angular/common/http": "ng.common.http", 13 | "@angular/router": "ng.router", 14 | "@angular/platform-browser": "ng.platformBrowser", 15 | "@angular/platform-server": "ng.platformServer", 16 | "@angular/platform-browser-dynamic": "ng.platformBrowserDynamic", 17 | "@angular/platform-browser/animations": "ng.platformBrowser.animations", 18 | "@angular/core/testing": "ng.core.testing", 19 | "@angular/common/testing": "ng.common.testing", 20 | "@angular/common/http/testing": "ng.common.http.testing", 21 | 22 | "rxjs": "rxjs", 23 | }; 24 | 25 | let plugins = [sourcemaps(), resolve()]; 26 | 27 | switch (target) { 28 | case "esm": 29 | Object.assign(globals, { 30 | tslib: "tslib" 31 | }); 32 | break; 33 | case "mumd": 34 | // @ts-ignore 35 | plugins.push(uglify()); 36 | break; 37 | } 38 | 39 | export default { 40 | exports: "named", 41 | name: "ngxUMeditor", 42 | plugins, 43 | external: Object.keys(globals), 44 | globals, 45 | output: { 46 | sourcemap: true 47 | } 48 | }; 49 | -------------------------------------------------------------------------------- /scripts/inline-template.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | const glob = require('glob').sync 4 | const less = require('less'); 5 | 6 | function inlineResourcesForDirectory(folderPath) { 7 | return Promise.all(glob(path.join(folderPath, '**/*.ts')).map(filePath => inlineResources(filePath))) 8 | } 9 | 10 | function inlineResources(filePath) { 11 | return new Promise(resolve => { 12 | let fileContent = fs.readFileSync(filePath, 'utf-8') 13 | 14 | fileContent = inlineTemplate(fileContent, filePath) 15 | 16 | inlineLess(fileContent, filePath).then(res => { 17 | fs.writeFileSync(filePath, res, 'utf-8'); 18 | resolve(); 19 | }).catch(() => resolve()); 20 | }); 21 | } 22 | 23 | function inlineLess(fileContent, filePath) { 24 | return new Promise(resolve => { 25 | const re = /styleUrls\s*:\s*\[\s*'([^']+?\.less)'\s*\]/g; 26 | const matches = re.exec(fileContent); 27 | if (matches == null || matches.length <= 0) { 28 | resolve(fileContent); 29 | return ; 30 | } 31 | const templatePath = path.join(path.dirname(filePath), matches[1]); 32 | const templateContent = loadResourceFile(templatePath); 33 | less.render(templateContent, {}).then(lessResult => { 34 | const newContent = fileContent.replace(re, (_match, templateUrl) => `styles: [\`${lessResult.css}\`]`); 35 | resolve(newContent); 36 | }).catch(() => resolve(fileContent)); 37 | }); 38 | } 39 | 40 | function inlineTemplate(fileContent, filePath) { 41 | return fileContent.replace(/templateUrl\s*:\s*'([^']+?\.html)'/g, (_match, templateUrl) => { 42 | const templatePath = path.join(path.dirname(filePath), templateUrl) 43 | const templateContent = loadResourceFile(templatePath) 44 | return `template: \`${templateContent}\`` 45 | }); 46 | } 47 | 48 | function loadResourceFile(filePath) { 49 | return fs.readFileSync(filePath, 'utf-8').replace(/([\n\r]\s*)+/gm, ' ') 50 | } 51 | 52 | inlineResourcesForDirectory('./__gen_lib').then(); 53 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ViewEncapsulation } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | template: ` 6 | 22 |

Angular2 百度UMeditor组件,有关更多细节见README.md

23 | 24 | `, 25 | encapsulation: ViewEncapsulation.None, 26 | }) 27 | export class AppComponent {} 28 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { HttpModule } from '@angular/http'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { Routes, RouterModule } from '@angular/router'; 5 | import { BrowserModule } from '@angular/platform-browser'; 6 | import { CommonModule } from '@angular/common'; 7 | import { HighlightJsModule } from 'ngx-highlight-js'; 8 | 9 | import { UMeditorModule } from 'ngx-umeditor'; 10 | 11 | import { AppComponent } from './app.component'; 12 | import { DemoComponent } from './components/demo.component'; 13 | import { DevComponent } from './components/dev.component'; 14 | 15 | @NgModule({ 16 | imports: [ 17 | BrowserModule, 18 | FormsModule, 19 | HttpModule, 20 | RouterModule.forRoot( 21 | [ 22 | { path: '', component: DemoComponent }, 23 | { path: 'dev', component: DevComponent }, 24 | ], 25 | { useHash: true }, 26 | ), 27 | CommonModule, 28 | HighlightJsModule, 29 | 30 | UMeditorModule.forRoot(), 31 | ], 32 | declarations: [AppComponent, DemoComponent, DevComponent], 33 | bootstrap: [AppComponent], 34 | }) 35 | export class AppModule {} 36 | -------------------------------------------------------------------------------- /src/app/components/demo.component.html: -------------------------------------------------------------------------------- 1 |
2 |
完整示例(Status: {{status}})
3 |
4 | 5 | 6 |
7 |
8 |
9 |
10 |
11 |
语言切换
12 |
13 | 14 | 15 |
16 |
常用API
17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 |
事件监听
37 |
38 | 39 | 40 | focus: {{focus}} 41 |
42 |
43 |
44 |
45 |
配置项
46 |
47 |
48 |
49 | 54 |
55 |
56 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
表单非空校验
69 |
70 | 71 | 72 |
73 | 74 |
75 |
76 |
77 |
78 | -------------------------------------------------------------------------------- /src/app/components/demo.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/app/components/demo.component.scss -------------------------------------------------------------------------------- /src/app/components/demo.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | OnInit, 4 | ViewEncapsulation, 5 | AfterViewInit, 6 | ViewChild, 7 | ElementRef, 8 | } from '@angular/core'; 9 | import { DomSanitizer } from '@angular/platform-browser'; 10 | import { UMeditorComponent } from 'ngx-umeditor'; 11 | 12 | @Component({ 13 | selector: 'demo', 14 | templateUrl: './demo.component.html', 15 | styleUrls: ['./demo.component.scss'], 16 | encapsulation: ViewEncapsulation.None, 17 | }) 18 | export class DemoComponent { 19 | @ViewChild('full') full: UMeditorComponent; 20 | full_source = ''; 21 | status = '初始中'; 22 | 23 | constructor(private el: ElementRef, public sanitizer: DomSanitizer) {} 24 | 25 | onReady(comp: UMeditorComponent) { 26 | this.status = '初始化完成'; 27 | console.log(comp); 28 | } 29 | 30 | setLanguage(lang: 'zh-cn' | 'en') { 31 | this.full.setLanguage(lang); 32 | } 33 | 34 | getAllHtml() { 35 | alert(this.full.Instance.getAllHtml()); 36 | } 37 | 38 | getContent() { 39 | const arr = []; 40 | arr.push('使用editor.getContent()方法可以获得编辑器的内容'); 41 | arr.push('内容为:'); 42 | arr.push(this.full.Instance.getContent()); 43 | alert(arr.join('\n')); 44 | } 45 | 46 | getContentTxt() { 47 | const arr = []; 48 | arr.push('使用editor.getContentTxt()方法可以获得编辑器的纯文本内容'); 49 | arr.push('编辑器的纯文本内容为:'); 50 | arr.push(this.full.Instance.getContentTxt()); 51 | alert(arr.join('\n')); 52 | } 53 | 54 | setContent(isAppendTo: boolean) { 55 | const arr = []; 56 | arr.push( 57 | '使用editor.setContent(\'欢迎使用ueditor\')方法可以设置编辑器的内容', 58 | ); 59 | this.full.Instance.setContent('欢迎使用ueditor', isAppendTo); 60 | alert(arr.join('\n')); 61 | } 62 | 63 | getPlainTxt() { 64 | const arr = []; 65 | arr.push( 66 | '使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容', 67 | ); 68 | arr.push('内容为:'); 69 | arr.push(this.full.Instance.getPlainTxt()); 70 | alert(arr.join('\n')); 71 | } 72 | 73 | hasContent() { 74 | const arr = []; 75 | arr.push('使用editor.hasContents()方法判断编辑器里是否有内容'); 76 | arr.push('判断结果为:'); 77 | arr.push(this.full.Instance.hasContents()); 78 | alert(arr.join('\n')); 79 | } 80 | 81 | insertHtml() { 82 | const value = prompt('插入html代码', ''); 83 | this.full.Instance.execCommand('insertHtml', value); 84 | } 85 | 86 | getText() { 87 | // 当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容 88 | const range = this.full.Instance.selection.getRange(); 89 | range.select(); 90 | const txt = this.full.Instance.selection.getText(); 91 | alert(txt); 92 | } 93 | 94 | focus: boolean | string; 95 | addListenerFocus() { 96 | this.full.addListener('focus', () => { 97 | this.focus = `fire focus in ${new Date().getTime()}`; 98 | }); 99 | this.focus = '监听中,尝试在编辑中输入几个字!'; 100 | } 101 | removeListenerFocus() { 102 | this.full.removeListener('focus'); 103 | this.focus = '已移除监听'; 104 | } 105 | 106 | config_source: string; 107 | config: any = { 108 | toolbar: ['undo redo | bold italic underline'], 109 | initialFrameHeight: 100, 110 | }; 111 | 112 | form_source: string; 113 | } 114 | -------------------------------------------------------------------------------- /src/app/components/dev.component.html: -------------------------------------------------------------------------------- 1 |
2 |
另一个完整示例(Status: {{status}})
3 |
4 | 5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | -------------------------------------------------------------------------------- /src/app/components/dev.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/app/components/dev.component.scss -------------------------------------------------------------------------------- /src/app/components/dev.component.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | OnInit, 4 | ViewEncapsulation, 5 | AfterViewInit, 6 | ViewChild, 7 | ElementRef, 8 | } from '@angular/core'; 9 | import { UMeditorComponent } from 'ngx-umeditor'; 10 | 11 | declare const UE: any; 12 | 13 | @Component({ 14 | selector: 'dev', 15 | templateUrl: './dev.component.html', 16 | styleUrls: ['./dev.component.scss'], 17 | encapsulation: ViewEncapsulation.None, 18 | }) 19 | export class DevComponent { 20 | @ViewChild('full') full: UMeditorComponent; 21 | full_source = `

Hello ${+new Date()}

`; 22 | status = '初始中'; 23 | 24 | onReady(comp: UMeditorComponent) { 25 | this.status = '初始化完成'; 26 | console.log(comp); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/assets/fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/fork.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/emotion.css: -------------------------------------------------------------------------------- 1 | .edui-popup-emotion .edui-emotion-jd img{ 2 | background:transparent url(images/jxface2.gif?v=1.1) no-repeat scroll left top; 3 | cursor:pointer;width:35px;height:35px;display:block; 4 | } 5 | .edui-popup-emotion .edui-emotion-pp img{ 6 | background:transparent url(images/fface.gif?v=1.1) no-repeat scroll left top; 7 | cursor:pointer;width:25px;height:25px;display:block; 8 | } 9 | 10 | .edui-popup-emotion .edui-emotion-ldw img{ 11 | background:transparent url(images/wface.gif?v=1.1) no-repeat scroll left top; 12 | cursor:pointer;width:35px;height:35px;display:block; 13 | } 14 | 15 | .edui-popup-emotion .edui-emotion-tsj img{ 16 | background:transparent url(images/tface.gif?v=1.1) no-repeat scroll left top; 17 | cursor:pointer;width:35px;height:35px;display:block; 18 | } 19 | 20 | .edui-popup-emotion .edui-emotion-cat img{ 21 | background:transparent url(images/cface.gif?v=1.1) no-repeat scroll left top; 22 | cursor:pointer;width:35px;height:35px;display:block; 23 | } 24 | 25 | .edui-popup-emotion .edui-emotion-bb img{ 26 | background:transparent url(images/bface.gif?v=1.1) no-repeat scroll left top; 27 | cursor:pointer;width:35px;height:35px;display:block; 28 | } 29 | 30 | .edui-popup-emotion .edui-emotion-youa img{ 31 | background:transparent url(images/yface.gif?v=1.1) no-repeat scroll left top; 32 | cursor:pointer;width:35px;height:35px;display:block; 33 | } 34 | 35 | .edui-popup-emotion .edui-emotion-smileytable { 36 | width: 100%; 37 | border-spacing: 0; 38 | border-collapse: collapse; 39 | table-layout: fixed; 40 | } 41 | 42 | .edui-popup-emotion .edui-emotion-wrapper { 43 | padding: 15px; 44 | } 45 | 46 | .edui-popup-emotion .edui-tab-nav{ 47 | height: auto; 48 | *height: 31px; 49 | } 50 | .edui-popup-emotion .edui-emotion-tabs{ 51 | clear: both; 52 | width: 0; 53 | height: 0; 54 | } 55 | 56 | .edui-popup-emotion .edui-tab-content { 57 | padding: 15px 0; 58 | } 59 | 60 | .edui-popup-emotion .edui-emotion-preview-box { 61 | width:90px; 62 | height:76px; 63 | border:2px solid #9cb945; 64 | background:#FFFFFF; 65 | background-position:center; 66 | background-repeat:no-repeat; 67 | position: absolute; 68 | top: 67px; 69 | left: 494px; 70 | display: none; 71 | } 72 | 73 | .edui-popup-emotion .edui-tab-text { 74 | font-size: 12px; 75 | } 76 | 77 | .edui-popup-emotion .edui-emotion-preview-left { 78 | left: 15px; 79 | } 80 | 81 | .edui-popup-emotion .edui-emotion-preview-img { 82 | width: 100%; 83 | height: 100%; 84 | display: block; 85 | background-repeat: no-repeat; 86 | background-position: center center; 87 | } 88 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/0.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/bface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/bface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/cface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/cface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/fface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/fface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/jxface2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/jxface2.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/neweditor-tab-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/neweditor-tab-bg.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/tface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/tface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/wface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/wface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/emotion/images/yface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/emotion/images/yface.gif -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/formula/formula.css: -------------------------------------------------------------------------------- 1 | .edui-popup-formula .edui-formula-wrapper { 2 | padding: 15px; 3 | } 4 | .edui-popup-formula .edui-formula-wrapper .edui-tab-nav{ 5 | height: auto; 6 | *height: 31px; 7 | } 8 | .edui-popup-formula .edui-formula-wrapper .edui-tab-text { 9 | font-size: 12px; 10 | } 11 | .edui-popup-formula .edui-formula-wrapper .edui-formula-clearboth { 12 | clear: both; 13 | width: 0; 14 | height: 0; 15 | } 16 | .edui-popup-formula .edui-formula-wrapper .edui-tab-pane ul { 17 | margin: 0px; 18 | padding: 0px; 19 | } 20 | .edui-popup-formula .edui-formula-wrapper .edui-tab-content { 21 | padding: 5px 0px 0px 0px; 22 | } 23 | .edui-popup-formula .edui-formula-wrapper .edui-tab-pane .edui-formula-latex-item { 24 | display: block; 25 | float: left; 26 | margin: 0px 3px 3px 0px; 27 | width: 30px; 28 | height: 30px; 29 | border:1px solid #cccccc; 30 | background-image: url("images/formula.png"); 31 | cursor: pointer; 32 | } -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/formula/formula.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Document 6 | 7 | 24 | 25 | 26 | 27 |
28 |
29 |
30 | 31 |
32 | 33 |
34 | 35 | 36 | 37 | 38 | 212 | 213 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/formula/formula.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | var editor = null; 4 | 5 | UM.registerWidget('formula', { 6 | 7 | tpl: "formula.css\">" + 8 | "
" + 9 | "
    " + 10 | "
    " + 11 | "
    ", 12 | 13 | sourceData: { 14 | formula: { 15 | 'common': [ 16 | "{/}frac{ }{ }", "^{ }/_{ }", "x^{ }", "x_{ }", "x^{ }_{ }", "{/}bar{ }", "{/}sqrt{ }", "{/}nthroot{ }{ }", 17 | "{/}sum^{ }_{n=}", "{/}sum", "{/}log_{ }", "{/}ln", "{/}int_{ }^{ }", "{/}oint_{ }^{ }" 18 | ], 19 | 'symbol': [ 20 | "+", "-", "{/}pm", "{/}times", "{/}ast", "{/}div", "/", "{/}bigtriangleup", 21 | "=", "{/}ne", "{/}approx", ">", "<", "{/}ge", "{/}le", "{/}infty", 22 | "{/}cap", "{/}cup", "{/}because", "{/}therefore", "{/}subset", "{/}supset", "{/}subseteq", "{/}supseteq", 23 | "{/}nsubseteq", "{/}nsupseteq", "{/}in", "{/}ni", "{/}notin", "{/}mapsto", "{/}leftarrow", "{/}rightarrow", 24 | "{/}Leftarrow", "{/}Rightarrow", "{/}leftrightarrow", "{/}Leftrightarrow" 25 | ], 26 | 'letter': [ 27 | "{/}alpha", "{/}beta", "{/}gamma", "{/}delta", "{/}varepsilon", "{/}varphi", "{/}lambda", "{/}mu", 28 | "{/}rho", "{/}sigma", "{/}omega", "{/}Gamma", "{/}Delta", "{/}Theta", "{/}Lambda", "{/}Xi", 29 | "{/}Pi", "{/}Sigma", "{/}Upsilon", "{/}Phi", "{/}Psi", "{/}Omega" 30 | ] 31 | } 32 | }, 33 | initContent: function (_editor, $widget) { 34 | 35 | var me = this, 36 | formula = me.sourceData.formula, 37 | lang = _editor.getLang('formula').static, 38 | formulaUrl = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/formula/', 39 | options = $.extend({}, lang, { 'formula_url': formulaUrl }), 40 | $root = me.root(); 41 | 42 | if (me.inited) { 43 | me.preventDefault(); 44 | return; 45 | } 46 | me.inited = true; 47 | 48 | editor = _editor; 49 | me.$widget = $widget; 50 | 51 | $root.html($.parseTmpl(me.tpl, options)); 52 | me.tabs = $.eduitab({selector: "#edui-formula-tab-Jpanel"}); 53 | 54 | /* 初始化popup的内容 */ 55 | var headHtml = [], xMax = 0, yMax = 0, 56 | $tabContent = me.root().find('.edui-tab-content'); 57 | $.each(formula, function (k, v) { 58 | var contentHtml = []; 59 | $.each(v, function (i, f) { 60 | contentHtml.push('
  • '); 61 | if (++xMax >=8) { 62 | ++yMax; xMax = 0; 63 | } 64 | }); 65 | yMax++; xMax = 0; 66 | $tabContent.append('
      ' + contentHtml.join('') + '
    '); 67 | headHtml.push('
  • ' + lang['lang_tab_' + k] + '
  • '); 68 | }); 69 | headHtml.push('
  • '); 70 | $root.find('.edui-tab-nav').html(headHtml.join('')); 71 | $root.find('.edui-tab-content').append('
    '); 72 | 73 | /* 选中第一个tab */ 74 | me.switchTab(0); 75 | }, 76 | initEvent: function () { 77 | var me = this; 78 | 79 | //防止点击过后关闭popup 80 | me.root().on('click', function (e) { 81 | return false; 82 | }); 83 | 84 | //点击tab切换菜单 85 | me.root().find('.edui-tab-nav').delegate('.edui-tab-item', 'click', function (evt) { 86 | me.switchTab(this); 87 | return false; 88 | }); 89 | 90 | //点击选中公式 91 | me.root().find('.edui-tab-pane').delegate('.edui-formula-latex-item', 'click', function (evt) { 92 | var $item = $(this), 93 | latex = $item.attr('data-latex') || ''; 94 | 95 | if (latex) { 96 | me.insertLatex(latex.replace("{/}", "\\")); 97 | } 98 | me.$widget.edui().hide(); 99 | return false; 100 | }); 101 | }, 102 | switchTab:function(index){ 103 | var me = this, 104 | $root = me.root(), 105 | index = $.isNumeric(index) ? index:$.inArray(index, $root.find('.edui-tab-nav .edui-tab-item')); 106 | 107 | $root.find('.edui-tab-nav .edui-tab-item').removeClass('edui-active').eq(index).addClass('edui-active'); 108 | $root.find('.edui-tab-content .edui-tab-pane').removeClass('edui-active').eq(index).addClass('edui-active'); 109 | 110 | /* 自动长高 */ 111 | me.autoHeight(0); 112 | }, 113 | autoHeight: function () { 114 | this.$widget.height(this.root() + 2); 115 | }, 116 | insertLatex: function (latex) { 117 | editor.execCommand('formula', latex ); 118 | }, 119 | width: 350, 120 | height: 400 121 | }); 122 | 123 | })(); 124 | 125 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/formula/images/formula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/formula/images/formula.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/image/image.css: -------------------------------------------------------------------------------- 1 | .edui-dialog-image .edui-image-wrapper{font-size: 12px;margin: 15px;} 2 | 3 | /*upload*/ 4 | .edui-dialog-image .edui-image-upload1{position: absolute;top:50%;left:50%;width:44px;height:38px;margin-top:-19px; margin-left: -22px;} 5 | .edui-dialog-image .edui-image-upload2{position:relative;float:left;width:120px;height:120px;margin:5px 0 0 5px;} 6 | 7 | .edui-dialog-image .edui-image-form{position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;opacity: 0;cursor: pointer;} 8 | .edui-dialog-image .edui-image-form .edui-image-file{width: 100%;height:100%;filter: alpha(opacity=0)} 9 | 10 | .edui-dialog-image .edui-image-upload1 .edui-image-icon{display: inline-block;width:44px;height:38px;background-image: url('images/upload1.png')} 11 | .edui-dialog-image .edui-image-upload1 .edui-image-icon.hover{background-position: -50px 0;} 12 | .edui-dialog-image .edui-image-upload2 .edui-image-icon{display: inline-block;width:120px;height:120px;background-image: url('images/upload2.png')} 13 | 14 | .edui-dialog-image .edui-image-dragTip{position: absolute;display:none;top:50%;left:50%;margin-top:30px;margin-left: -60px; 15 | color: #222;font-size:14px;text-shadow: 0px 2px 3px #555;} 16 | 17 | .edui-dialog-image .edui-image-content{height:330px;width:100%;position: relative;} 18 | 19 | .edui-dialog-image .edui-image-mask{display: none;position: absolute;top:0;left:0;width: 100%; height: 100%;background-color:#fff; 20 | text-align: center;line-height:300px;color:#000;font-size:14px;font-weight:bold;opacity: 0.6;filter: alpha(opacity=60);} 21 | .edui-dialog-image .edui-image-mask.edui-active{display: block;} 22 | 23 | /*network*/ 24 | .edui-dialog-image .edui-image-searchBar{margin: 10px;} 25 | .edui-dialog-image .edui-image-searchBar .edui-image-searchTxt{display: inline-block !important;*display: inline !important;*zoom:1;width:400px; border: 1px solid #c5d2ff; height: 20px; line-height: 18px; font-size: 14px; padding: 3px; margin: 0;outline:0;} 26 | .edui-dialog-image .edui-image-searchBar .edui-image-searchAdd{display: inline-block !important;*display: inline !important;*zoom:1; 27 | width:60px; text-align:center;height: 25px;text-align: center;line-height: 25px; 28 | background-color: #ffffff;padding: 0; border: 1px solid #ababab;margin-left: 20px;cursor: pointer; 29 | } 30 | .edui-dialog-image .edui-image-searchBar .edui-image-searchAdd.hover{ 31 | background-color: #d5e1f2; 32 | padding: 0; 33 | border: 1px solid #a3bde3; 34 | } 35 | .edui-dialog-image .edui-image-searchRes{height:280px;overflow:auto;} 36 | 37 | 38 | /*common*/ 39 | .edui-dialog-image .edui-image-item{position:relative;float:left;width:120px;height:120px;border: 1px solid #CCC;cursor: default;margin: 5px 0 0 5px;} 40 | .edui-dialog-image .edui-image-item .edui-image-pic{position: absolute;left:-9999px;} 41 | .edui-dialog-image .edui-image-item .edui-image-close{position:absolute;right:0;background: url('images/close.png');width:17px;height:17px;cursor:pointer;z-index:1} 42 | .edui-dialog-image .edui-image-item.hover .edui-image-close{display: block;} 43 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/image/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/image/images/close.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/image/images/upload1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/image/images/upload1.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/image/images/upload2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/image/images/upload2.png -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/link/link.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var utils = UM.utils; 3 | function hrefStartWith(href, arr) { 4 | href = href.replace(/^\s+|\s+$/g, ''); 5 | for (var i = 0, ai; ai = arr[i++];) { 6 | if (href.indexOf(ai) == 0) { 7 | return true; 8 | } 9 | } 10 | return false; 11 | } 12 | 13 | UM.registerWidget('link', { 14 | tpl: "" + 18 | "" + 19 | "" + 20 | "" + 21 | "" + 22 | "" + 23 | "" + 24 | "" + 25 | "" + 26 | "" + 27 | "" + 28 | "" + 32 | "" + 33 | // "" + 34 | // "" + 35 | // "" + 36 | "", 37 | initContent: function (editor) { 38 | var lang = editor.getLang('link'); 39 | if (lang) { 40 | var html = $.parseTmpl(this.tpl, lang.static); 41 | } 42 | this.root().html(html); 43 | }, 44 | initEvent: function (editor, $w) { 45 | var link = editor.queryCommandValue('link'); 46 | if(link){ 47 | $('#edui-link-Jhref',$w).val(utils.html($(link).attr('href'))); 48 | $('#edui-link-Jtitle',$w).val($(link).attr('title')); 49 | $(link).attr('target') == '_blank' && $('#edui-link-Jtarget').attr('checked',true) 50 | } 51 | $('#edui-link-Jhref',$w).focus(); 52 | }, 53 | buttons: { 54 | 'ok': { 55 | exec: function (editor, $w) { 56 | var href = $('#edui-link-Jhref').val().replace(/^\s+|\s+$/g, ''); 57 | 58 | if (href) { 59 | editor.execCommand('link', { 60 | 'href': href, 61 | 'target': $("#edui-link-Jtarget:checked").length ? "_blank" : '_self', 62 | 'title': $("#edui-link-Jtitle").val().replace(/^\s+|\s+$/g, ''), 63 | '_href': href 64 | }); 65 | } 66 | } 67 | }, 68 | 'cancel':{} 69 | }, 70 | width: 400 71 | }) 72 | })(); 73 | 74 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/map/map.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 百度地图API自定义地图 9 | 10 | 17 | 18 | 19 | 20 | 21 | 22 |
    23 | 24 | 148 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/map/map.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | var widgetName = 'map'; 4 | 5 | UM.registerWidget(widgetName, { 6 | 7 | tpl: "" + 19 | "
    " + 20 | "" + 21 | "" + 22 | "" + 23 | "" + 24 | "" + 25 | "" + 26 | "" + 27 | ""+ 28 | "" + 29 | "
    <%=lang_city%>:\"/><%=lang_address%>:<%=lang_search%>
    " + 30 | "
    " + 31 | "
    " + 32 | "", 57 | initContent: function (editor, $widget) { 58 | 59 | var me = this, 60 | lang = editor.getLang(widgetName), 61 | theme_url = editor.options.themePath + editor.options.theme; 62 | 63 | if( me.inited ) { 64 | me.preventDefault(); 65 | return false; 66 | } 67 | 68 | me.inited = true; 69 | 70 | me.lang = lang; 71 | me.editor = editor; 72 | 73 | me.root().html($.parseTmpl(me.tpl, $.extend({}, lang['static'], { 74 | 'theme_url': theme_url 75 | }))); 76 | 77 | me.initRequestApi(); 78 | 79 | }, 80 | /** 81 | * 初始化请求API 82 | */ 83 | initRequestApi: function () { 84 | 85 | var $ifr = null; 86 | 87 | //已经初始化过, 不用再次初始化 88 | if (window.BMap && window.BMap.Map) { 89 | this.initBaiduMap(); 90 | } else { 91 | 92 | $ifr = $(''); 93 | $ifr.appendTo( this.root() ); 94 | 95 | $ifr = $ifr[ 0 ].contentWindow.document; 96 | 97 | $ifr.open(); 98 | $ifr.write( this.root().find(".edui-tpl-container").html().replace( /scr_ipt/g, 'script').replace('<>',"'" + this.editor.id + "'") ); 99 | 100 | } 101 | 102 | }, 103 | requestMapApi: function (src) { 104 | 105 | var me = this; 106 | 107 | if (src.length) { 108 | 109 | var _src = src[0]; 110 | 111 | src = src.slice(1); 112 | 113 | if (_src) { 114 | $.getScript(_src, function () { 115 | me.requestMapApi(src); 116 | }); 117 | } else { 118 | me.requestMapApi(src); 119 | } 120 | 121 | } else { 122 | 123 | me.initBaiduMap(); 124 | 125 | } 126 | 127 | 128 | }, 129 | initBaiduMap: function () { 130 | 131 | var $root = this.root(), 132 | map = new BMap.Map($root.find(".edui-map-container")[0]), 133 | me = this, 134 | marker, 135 | point, 136 | imgcss, 137 | img = $(me.editor.selection.getRange().getClosedNode()); 138 | 139 | map.enableInertialDragging(); 140 | map.enableScrollWheelZoom(); 141 | map.enableContinuousZoom(); 142 | 143 | if (img.length && /api[.]map[.]baidu[.]com/ig.test(img.attr("src"))) { 144 | var url = img.attr("src"), 145 | centerPos = me.getPars(url, "center").split(","), 146 | markerPos = me.getPars(url, "markers").split(","); 147 | point = new BMap.Point(Number(centerPos[0]), Number(centerPos[1])); 148 | marker = new BMap.Marker(new BMap.Point(Number(markerPos[0]), Number(markerPos[1]))); 149 | map.addControl(new BMap.NavigationControl()); 150 | map.centerAndZoom(point, Number(me.getPars(url, "zoom"))); 151 | imgcss = img.attr('style'); 152 | } else { 153 | point = new BMap.Point(116.404, 39.915); // 创建点坐标 154 | marker = new BMap.Marker(point); 155 | map.addControl(new BMap.NavigationControl()); 156 | map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。 157 | } 158 | marker.enableDragging(); 159 | map.addOverlay(marker); 160 | 161 | me.map = map; 162 | me.marker = marker; 163 | me.imgcss = imgcss; 164 | }, 165 | doSearch: function () { 166 | var me = this, 167 | city = me.root().find('.edui-map-city').val(), 168 | address = me.root().find('.edui-map-address').val(); 169 | 170 | if (!city) { 171 | alert(me.lang.cityMsg); 172 | return; 173 | } 174 | var search = new BMap.LocalSearch(city, { 175 | onSearchComplete: function (results) { 176 | if (results && results.getNumPois()) { 177 | var points = []; 178 | for (var i = 0; i < results.getCurrentNumPois(); i++) { 179 | points.push(results.getPoi(i).point); 180 | } 181 | if (points.length > 1) { 182 | me.map.setViewport(points); 183 | } else { 184 | me.map.centerAndZoom(points[0], 13); 185 | } 186 | point = me.map.getCenter(); 187 | me.marker.setPoint(point); 188 | } else { 189 | alert(me.lang.errorMsg); 190 | } 191 | } 192 | }); 193 | search.search(address || city); 194 | }, 195 | getPars: function (str, par) { 196 | var reg = new RegExp(par + "=((\\d+|[.,])*)", "g"); 197 | return reg.exec(str)[1]; 198 | }, 199 | reset: function(){ 200 | this.map && this.map.reset(); 201 | }, 202 | initEvent: function () { 203 | var me = this, 204 | $root = me.root(); 205 | 206 | $root.find('.edui-map-address').on('keydown', function (evt) { 207 | evt = evt || event; 208 | if (evt.keyCode == 13) { 209 | me.doSearch(); 210 | return false; 211 | } 212 | }); 213 | 214 | $root.find(".edui-map-button").on('click', function (evt) { 215 | me.doSearch(); 216 | }); 217 | 218 | $root.find(".edui-map-address").focus(); 219 | 220 | $root.on( "mousewheel DOMMouseScroll", function ( e ) { 221 | return false; 222 | } ); 223 | 224 | }, 225 | width: 580, 226 | height: 408, 227 | buttons: { 228 | ok: { 229 | exec: function (editor) { 230 | var widget = editor.getWidgetData(widgetName), 231 | center = widget.map.getCenter(), 232 | zoom = widget.map.getZoom(), 233 | size = widget.map.getSize(), 234 | point = widget.marker.P; 235 | 236 | if (widget.root().find(".edui-map-dynamic")[0].checked) { 237 | var URL = editor.getOpt('UMEDITOR_HOME_URL'), 238 | url = [URL + (/\/$/.test(URL) ? '':'/') + "dialogs/map/map.html" + 239 | '#center=' + center.lng + ',' + center.lat, 240 | '&zoom=' + zoom, 241 | '&width=' + size.width, 242 | '&height=' + size.height, 243 | '&markers=' + point.lng + ',' + point.lat].join(''); 244 | editor.execCommand('inserthtml', ''); 245 | } else { 246 | url = "http://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat + 247 | "&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat; 248 | editor.execCommand('inserthtml', '', true); 249 | } 250 | 251 | widget.reset(); 252 | } 253 | }, 254 | cancel: { 255 | exec: function(editor){ 256 | editor.getWidgetData(widgetName).reset(); 257 | } 258 | } 259 | } 260 | }); 261 | 262 | })(); 263 | 264 | -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/images/center_focus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/video/images/center_focus.jpg -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/images/left_focus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/video/images/left_focus.jpg -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/images/none_focus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/video/images/none_focus.jpg -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/images/right_focus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/dialogs/video/images/right_focus.jpg -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/video.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | .edui-dialog-video .edui-video-wrapper{ width: 570px;_width:575px;margin: 10px auto; zoom:1;position: relative} 3 | .edui-dialog-video .edui-video-tabbody{height:335px;} 4 | .edui-dialog-video .edui-video-panel { position: absolute;width:100%; height:100%;background: #fff;} 5 | .edui-dialog-video .edui-video-panel table td{vertical-align: middle;} 6 | .edui-dialog-video #eduiVideoUrl { 7 | width: 470px; 8 | height: 21px; 9 | line-height: 21px; 10 | margin: 8px 5px; 11 | background: #FFF; 12 | border: 1px solid #d7d7d7; 13 | } 14 | .edui-dialog-video #eduiVideoSearchTxt{margin-left:15px;background: #FFF;width:200px;height:21px;line-height:21px;border: 1px solid #d7d7d7;} 15 | .edui-dialog-video #searchList{width: 570px;overflow: auto;zoom:1;height: 270px;} 16 | .edui-dialog-video #searchList div{float: left;width: 120px;height: 135px;margin: 5px 15px;} 17 | .edui-dialog-video #searchList img{margin: 2px 8px;cursor: pointer;border: 2px solid #fff} /*不用缩略图*/ 18 | .edui-dialog-video #searchList p{margin-left: 10px;} 19 | .edui-dialog-video #eduiVideoType{ 20 | width: 65px; 21 | height: 23px; 22 | line-height: 22px; 23 | border: 1px solid #d7d7d7; 24 | } 25 | .edui-dialog-video #eduiVideoSearchBtn,.edui-dialog-video #eduiVideoSearchReset{ 26 | /*width: 80px;*/ 27 | height: 25px; 28 | line-height: 25px; 29 | background: #eee; 30 | border: 1px solid #d7d7d7; 31 | cursor: pointer; 32 | padding: 0 5px; 33 | } 34 | 35 | 36 | 37 | .edui-dialog-video #eduiVideoPreview{width: 420px; margin-left: 10px; _margin-left:5px; height: 280px;background-color: #ddd;float: left} 38 | .edui-dialog-video #eduiVideoInfo {width: 120px;float: left;margin-left: 10px;_margin-left:7px;} 39 | .edui-dialog-video .edui-video-wrapper fieldset{ 40 | border: 1px solid #ddd; 41 | padding-left: 5px; 42 | margin-bottom: 20px; 43 | padding-bottom: 5px; 44 | width: 115px; 45 | } 46 | .edui-dialog-video .edui-video-wrapper fieldset legend{font-weight: bold;} 47 | .edui-dialog-video .edui-video-wrapper fieldset p{line-height: 30px;} 48 | .edui-dialog-video .edui-video-wrapper fieldset input.edui-video-txt{ 49 | width: 65px; 50 | height: 21px; 51 | line-height: 21px; 52 | margin: 8px 5px; 53 | background: #FFF; 54 | border: 1px solid #d7d7d7; 55 | } 56 | .edui-dialog-video .edui-video-wrapper label.edui-video-url{font-weight: bold;margin-left: 5px;color: #06c;} 57 | .edui-dialog-video #eduiVideoFloat div{cursor:pointer;opacity: 0.5;filter: alpha(opacity = 50);margin:9px;_margin:5px;width:38px;height:36px;float:left;} 58 | .edui-dialog-video #eduiVideoFloat .edui-video-focus{opacity: 1;filter: alpha(opacity = 100)} 59 | .edui-dialog-video .edui-video-wrapper span.edui-video-view{display: inline-block;width: 30px;float: right;cursor: pointer;color: blue} -------------------------------------------------------------------------------- /src/assets/umeditor/dialogs/video/video.js: -------------------------------------------------------------------------------- 1 | 2 | (function(){ 3 | var domUtils = UM.dom.domUtils; 4 | var widgetName = 'video'; 5 | 6 | UM.registerWidget( widgetName,{ 7 | 8 | tpl: "video.css\" />" + 9 | "
    " + 10 | "
    " + 11 | "
    " + 12 | "<%=lang_tab_insertV%>" + 13 | "
    " + 14 | "
    " + 15 | "
    " + 16 | "
    " + 17 | "
    " + 18 | "
    " + 19 | "
    " + 20 | "<%=lang_video_size%>" + 21 | "" + 22 | "" + 23 | "" + 24 | "
    " + 25 | "
    " + 26 | "
    " + 27 | "<%=lang_alignment%>" + 28 | "
    " + 29 | "
    " + 30 | "
    " + 31 | "
    " + 32 | "
    " + 33 | "
    " + 34 | "
    ", 35 | initContent:function( editor, $widget ){ 36 | 37 | var me = this, 38 | lang = editor.getLang( widgetName), 39 | video_url = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/video/'; 40 | 41 | me.lang = lang; 42 | me.editor = editor; 43 | me.$widget = $widget; 44 | me.root().html( $.parseTmpl( me.tpl, $.extend( { video_url: video_url }, lang['static'] ) ) ); 45 | 46 | me.initController( lang ); 47 | 48 | }, 49 | initEvent:function(){ 50 | 51 | var me = this, 52 | url = $("#eduiVideoUrl", me.$widget)[0]; 53 | 54 | if( 'oninput' in url ) { 55 | url.oninput = function(){ 56 | me.createPreviewVideo( this.value ); 57 | }; 58 | } else { 59 | url.onpropertychange = function () { 60 | me.createPreviewVideo( this.value ); 61 | } 62 | } 63 | 64 | }, 65 | initController: function( lang ){ 66 | 67 | var me = this, 68 | img = me.editor.selection.getRange().getClosedNode(), 69 | url; 70 | 71 | me.createAlignButton( ["eduiVideoFloat"] ); 72 | 73 | //编辑视频时初始化相关信息 74 | if(img && img.className == "edui-faked-video"){ 75 | $("#eduiVideoUrl", me.$widget)[0].value = url = img.getAttribute("_url"); 76 | $("#eduiVideoWidth", me.$widget)[0].value = img.width; 77 | $("#eduiVideoHeight", me.$widget)[0].value = img.height; 78 | var align = domUtils.getComputedStyle(img,"float"), 79 | parentAlign = domUtils.getComputedStyle(img.parentNode,"text-align"); 80 | me.updateAlignButton(parentAlign==="center"?"center":align); 81 | } 82 | me.createPreviewVideo(url); 83 | 84 | }, 85 | /** 86 | * 根据url生成视频预览 87 | */ 88 | createPreviewVideo: function(url){ 89 | 90 | if ( !url )return; 91 | 92 | var me = this, 93 | lang = me.lang, 94 | conUrl = me.convert_url(url); 95 | 96 | if(!me.endWith(conUrl,[".swf",".flv",".wmv"])){ 97 | $("#eduiVideoPreview", me.$widget).html( lang.urlError ); 98 | return; 99 | } 100 | $("#eduiVideoPreview", me.$widget)[0].innerHTML = ''; 105 | 106 | }, 107 | /** 108 | * 将单个视频信息插入编辑器中 109 | */ 110 | insertSingle: function(){ 111 | 112 | var me = this, 113 | width = $("#eduiVideoWidth", me.$widget)[0], 114 | height = $("#eduiVideoHeight", me.$widget)[0], 115 | url=$('#eduiVideoUrl', me.$widget)[0].value, 116 | align = this.findFocus("eduiVideoFloat","name"); 117 | 118 | if(!url) return false; 119 | if ( !me.checkNum( [width, height] ) ) return false; 120 | this.editor.execCommand('insertvideo', { 121 | url: me.convert_url(url), 122 | width: width.value, 123 | height: height.value, 124 | align: align 125 | }); 126 | 127 | }, 128 | /** 129 | * URL转换 130 | */ 131 | convert_url: function(url){ 132 | if ( !url ) return ''; 133 | var matches = url.match(/youtu.be\/(\w+)$/) || 134 | url.match(/youtube\.com\/watch\?v=(\w+)/) || 135 | url.match(/youtube.com\/v\/(\w+)/), 136 | youku = url.match(/youku\.com\/v_show\/id_(\w+)/), 137 | youkuPlay = /player\.youku\.com/ig.test(url); 138 | 139 | if(youkuPlay){ 140 | url = url.replace(/\?f=.*/, ""); 141 | } else if (matches){ 142 | url = "https://www.youtube.com/v/" + matches[1] + "?version=3&feature=player_embedded"; 143 | }else if(youku){ 144 | url = "http://player.youku.com/player.php/sid/"+youku[1]+"/v.swf" 145 | } else { 146 | url = url.replace(/http:\/\/www\.tudou\.com\/programs\/view\/([\w\-]+)\/?/i, "http://www.tudou.com/v/$1") 147 | .replace(/http:\/\/www\.youtube\.com\/watch\?v=([\w\-]+)/i, "http://www.youtube.com/v/$1") 148 | .replace(/http:\/\/v\.youku\.com\/v_show\/id_([\w\-=]+)\.html/i, "http://player.youku.com/player.php/sid/$1") 149 | .replace(/http:\/\/www\.56\.com\/u\d+\/v_([\w\-]+)\.html/i, "http://player.56.com/v_$1.swf") 150 | .replace(/http:\/\/www.56.com\/w\d+\/play_album\-aid\-\d+_vid\-([^.]+)\.html/i, "http://player.56.com/v_$1.swf") 151 | .replace(/http:\/\/v\.ku6\.com\/.+\/([^.]+)\.html/i, "http://player.ku6.com/refer/$1/v.swf") 152 | .replace(/\?f=.*/, ""); 153 | } 154 | return url; 155 | }, 156 | /** 157 | * 检测传入的所有input框中输入的长宽是否是正数 158 | */ 159 | checkNum: function checkNum( nodes ) { 160 | 161 | var me = this; 162 | 163 | for ( var i = 0, ci; ci = nodes[i++]; ) { 164 | var value = ci.value; 165 | if ( !me.isNumber( value ) && value) { 166 | alert( me.lang.numError ); 167 | ci.value = ""; 168 | ci.focus(); 169 | return false; 170 | } 171 | } 172 | return true; 173 | }, 174 | /** 175 | * 数字判断 176 | * @param value 177 | */ 178 | isNumber: function( value ) { 179 | return /(0|^[1-9]\d*$)/.test( value ); 180 | }, 181 | updateAlignButton: function( align ) { 182 | var aligns = $( "#eduiVideoFloat", this.$widget )[0].children; 183 | 184 | for ( var i = 0, ci; ci = aligns[i++]; ) { 185 | if ( ci.getAttribute( "name" ) == align ) { 186 | if ( ci.className !="edui-video-focus" ) { 187 | ci.className = "edui-video-focus"; 188 | } 189 | } else { 190 | if ( ci.className =="edui-video-focus" ) { 191 | ci.className = ""; 192 | } 193 | } 194 | } 195 | 196 | }, 197 | /** 198 | * 创建图片浮动选择按钮 199 | * @param ids 200 | */ 201 | createAlignButton: function( ids ) { 202 | var lang = this.lang, 203 | vidoe_home = UMEDITOR_CONFIG.UMEDITOR_HOME_URL + 'dialogs/video/'; 204 | 205 | for ( var i = 0, ci; ci = ids[i++]; ) { 206 | var floatContainer = $( "#" + ci, this.$widget ) [0], 207 | nameMaps = {"none":lang['default'], "left":lang.floatLeft, "right":lang.floatRight}; 208 | for ( var j in nameMaps ) { 209 | var div = document.createElement( "div" ); 210 | div.setAttribute( "name", j ); 211 | if ( j == "none" ) div.className="edui-video-focus"; 212 | div.style.cssText = "background:url("+ vidoe_home +"images/" + j + "_focus.jpg);"; 213 | div.setAttribute( "title", nameMaps[j] ); 214 | floatContainer.appendChild( div ); 215 | } 216 | this.switchSelect( ci ); 217 | } 218 | }, 219 | /** 220 | * 选择切换 221 | */ 222 | switchSelect: function( selectParentId ) { 223 | var selects = $( "#" + selectParentId, this.$widget )[0].children; 224 | for ( var i = 0, ci; ci = selects[i++]; ) { 225 | $(ci).on("click", function () { 226 | for ( var j = 0, cj; cj = selects[j++]; ) { 227 | cj.className = ""; 228 | cj.removeAttribute && cj.removeAttribute( "class" ); 229 | } 230 | this.className = "edui-video-focus"; 231 | } ) 232 | } 233 | }, 234 | /** 235 | * 找到id下具有focus类的节点并返回该节点下的某个属性 236 | * @param id 237 | * @param returnProperty 238 | */ 239 | findFocus: function( id, returnProperty ) { 240 | var tabs = $( "#" + id , this.$widget)[0].children, 241 | property; 242 | for ( var i = 0, ci; ci = tabs[i++]; ) { 243 | if ( ci.className=="edui-video-focus" ) { 244 | property = ci.getAttribute( returnProperty ); 245 | break; 246 | } 247 | } 248 | return property; 249 | }, 250 | /** 251 | * 末尾字符检测 252 | */ 253 | endWith: function(str,endStrArr){ 254 | for(var i=0,len = endStrArr.length;i 2 | 3 | 4 | 5 | 6 | UMEDITOR 完整demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 113 | 114 | 115 |

    UMEDITOR 完整demo

    116 | 117 | 118 | 121 | 122 | 123 |
    124 |
    125 | 126 | 127 | 136 | 137 | 138 | 147 | 148 | 149 | 155 | 156 | 157 |
    128 |   129 |   130 |   131 |   132 |   133 |   134 | 135 |
    139 |   140 |   141 |   142 |   143 |   144 |   145 | 146 |
    150 |   151 |   152 |   153 | 154 |
    158 |
    159 | 160 | 161 | 165 | 166 |
    162 | 163 | 164 |
    167 | 168 |
    169 |

    170 |
    171 | 276 | 277 | 278 | -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/en.js: -------------------------------------------------------------------------------- 1 | /** 2 | * English language package 3 | */ 4 | UM.I18N['en'] = { 5 | 'labelMap':{ 6 | 'anchor':'Anchor', 'undo':'Undo', 'redo':'Redo', 'bold':'Bold', 'indent':'Indent', 'snapscreen':'SnapScreen', 7 | 'italic':'Italic', 'underline':'Underline', 'strikethrough':'Strikethrough', 'subscript':'SubScript','fontborder':'text border', 8 | 'superscript':'SuperScript', 'formatmatch':'Format Match', 'source':'Source', 'blockquote':'BlockQuote', 9 | 'pasteplain':'PastePlain', 'selectall':'SelectAll', 'print':'Print', 'preview':'Preview', 10 | 'horizontal':'Horizontal', 'removeformat':'RemoveFormat', 'time':'Time', 'date':'Date', 11 | 'unlink':'Unlink', 'insertrow':'InsertRow', 'insertcol':'InsertCol', 'mergeright':'MergeRight', 'mergedown':'MergeDown', 12 | 'deleterow':'DeleteRow', 'deletecol':'DeleteCol', 'splittorows':'SplitToRows','insertcode':'insert code', 13 | 'splittocols':'SplitToCols', 'splittocells':'SplitToCells','deletecaption':'DeleteCaption','inserttitle':'InsertTitle', 14 | 'mergecells':'MergeCells', 'deletetable':'DeleteTable', 'cleardoc':'Clear', 'insertparagraphbeforetable':"InsertParagraphBeforeTable", 15 | 'fontfamily':'FontFamily', 'fontsize':'FontSize', 'paragraph':'Paragraph', 'image':'Image','edittable':'Edit Table', 'edittd':'Edit Td','link':'Link', 16 | 'emotion':'Emotion', 'spechars':'Spechars', 'searchreplace':'SearchReplace', 'map':'BaiduMap', 'gmap':'GoogleMap', 17 | 'video':'Video', 'help':'Help', 'justifyleft':'JustifyLeft', 'justifyright':'JustifyRight', 'justifycenter':'JustifyCenter', 18 | 'justifyjustify':'Justify', 'forecolor':'FontColor', 'backcolor':'BackColor', 'insertorderedlist':'OL', 19 | 'insertunorderedlist':'UL', 'fullscreen':'FullScreen', 'directionalityltr':'EnterFromLeft', 'directionalityrtl':'EnterFromRight', 20 | 'rowspacingtop':'RowSpacingTop', 'rowspacingbottom':'RowSpacingBottom', 'highlightcode':'Code', 'pagebreak':'PageBreak', 'insertframe':'Iframe', 'imagenone':'Default', 21 | 'imageleft':'ImageLeft', 'imageright':'ImageRight', 'attachment':'Attachment', 'imagecenter':'ImageCenter', 'wordimage':'WordImage', 22 | 'lineheight':'LineHeight','edittip':'EditTip','customstyle':'CustomStyle', 'scrawl':'Scrawl', 'autotypeset':'AutoTypeset', 23 | 'webapp':'WebAPP', 'touppercase':'UpperCase', 'tolowercase':'LowerCase','template':'Template','background':'Background','inserttable':'InsertTable', 24 | 'drafts': 'drafts', 'formula':'formula' 25 | }, 26 | 'paragraph':{'p':'Paragraph', 'h1':'Title 1', 'h2':'Title 2', 'h3':'Title 3', 'h4':'Title 4', 'h5':'Title 5', 'h6':'Title 6'}, 27 | 'fontfamily':{ 28 | 'songti':'Sim sun', 29 | 'kaiti':'Sim kai', 30 | 'heiti':'Sim hei', 31 | 'lishu':'Sim li', 32 | 'yahei': 'Microsoft yahei', 33 | 'andaleMono':'Andale mono', 34 | 'arial': 'Arial', 35 | 'arialBlack':'Arial black', 36 | 'comicSansMs':'Comic sans ms', 37 | 'impact':'Impact', 38 | 'timesNewRoman':'Times new roman' 39 | }, 40 | 'ok':"OK", 41 | 'cancel':"Cancel", 42 | 'closeDialog':"closeDialog", 43 | 'tableDrag':"You must import the file uiUtils.js before drag! ", 44 | 'autofloatMsg':"The plugin AutoFloat depends on EditorUI!", 45 | 'anthorMsg':"Link", 46 | 'clearColor':'Clear', 47 | 'standardColor':'Standard color', 48 | 'themeColor':'Theme color', 49 | 'property':'Property', 50 | 'default':'Default', 51 | 'modify':'Modify', 52 | 'justifyleft':'Justify Left', 53 | 'justifyright':'Justify Right', 54 | 'justifycenter':'Justify Center', 55 | 'justify':'Default', 56 | 'clear':'Clear', 57 | 'anchorMsg':'Anchor', 58 | 'delete':'Delete', 59 | 'clickToUpload':"Click to upload", 60 | 'unset':"Language hasn't been set!", 61 | 't_row':'row', 62 | 't_col':'col', 63 | 'more':'More', 64 | 'pasteOpt':'Paste Option', 65 | 'pasteSourceFormat':"Keep Source Formatting", 66 | 'tagFormat':'Keep tag', 67 | 'pasteTextFormat':'Keep Text only', 68 | 69 | //===============dialog i18N======================= 70 | 'image':{ 71 | 'static':{ 72 | 'lang_tab_local':"Local Upload", 73 | 'lang_tab_imgSearch':"Network Pictures", 74 | 'lang_input_dragTip':"Support drag upload", 75 | 'lang_btn_add':"Add" 76 | }, 77 | 'uploadError': 'Upload Error' 78 | }, 79 | 'emotion':{ 80 | 'static':{ 81 | 'lang_input_choice':'Choice', 82 | 'lang_input_Tuzki':'Tuzki', 83 | 'lang_input_lvdouwa':'LvDouWa', 84 | 'lang_input_BOBO':'BOBO', 85 | 'lang_input_babyCat':'BabyCat', 86 | 'lang_input_bubble':'Bubble', 87 | 'lang_input_youa':'YouA' 88 | } 89 | }, 90 | 'gmap':{ 91 | 'static':{ 92 | 'lang_input_address':'Address:', 93 | 'lang_input_search':'Search', 94 | 'address':{'value':"Beijing"} 95 | }, 96 | 'searchError':'Unable to locate the address!' 97 | }, 98 | 'link':{ 99 | 'static':{ 100 | 'lang_input_text':'Text:', 101 | 'lang_input_url':'URL:', 102 | 'lang_input_title':'Title:', 103 | 'lang_input_target':'open in new window:' 104 | }, 105 | 'validLink':'Supports only effective when a link is selected', 106 | 'httpPrompt':'The hyperlink you enter should start with "http|https|ftp://"!' 107 | }, 108 | 'map':{ 109 | 'static':{ 110 | 'lang_city':"City", 111 | 'lang_address':"Address", 112 | 'city':{'value':"Beijing"}, 113 | 'lang_search':"Search", 114 | 'lang_dynamicmap':"Dynamic map" 115 | }, 116 | 'cityMsg':"Please enter the city name!", 117 | 'errorMsg':"Can't find the place!" 118 | }, 119 | 'video':{ 120 | 'static':{ 121 | 'lang_tab_insertV':"Video", 122 | 'lang_video_url':" URL ", 123 | 'lang_video_size':"Video Size", 124 | 'lang_videoW':"Width", 125 | 'lang_videoH':"Height", 126 | 'lang_alignment':"Alignment", 127 | 'videoSearchTxt':{'value':"Enter the search keyword!"}, 128 | 'videoType':{'options':["All", "Hot", "Entertainment", "Funny", "Sports", "Science", "variety"]}, 129 | 'videoSearchBtn':{'value':"Search in Baidu"}, 130 | 'videoSearchReset':{'value':"Clear result"} 131 | }, 132 | 'numError':"Please enter the correct Num. e.g 123,400", 133 | 'floatLeft':"Float left", 134 | 'floatRight':"Float right", 135 | 'default':"Default", 136 | 'block':"Display in block", 137 | 'urlError':"The video url format may be wrong!", 138 | 'loading':"  The video is loading, please wait…", 139 | 'clickToSelect':"Click to select", 140 | 'goToSource':'Visit source video ', 141 | 'noVideo':"    Sorry,can't find the video,please try again!" 142 | }, 143 | 'formula':{ 144 | 'static':{ 145 | 'lang_tab_common':'Common', 146 | 'lang_tab_symbol':'Symbol', 147 | 'lang_tab_letter':'Letter' 148 | } 149 | } 150 | }; -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/addimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/addimage.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/alldeletebtnhoverskin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/alldeletebtnhoverskin.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/alldeletebtnupskin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/alldeletebtnupskin.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/background.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/button.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/copy.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/deletedisable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/deletedisable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/deleteenable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/deleteenable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/imglabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/imglabel.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/listbackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/listbackground.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/localimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/localimage.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/music.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/rotateleftdisable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/rotateleftdisable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/rotateleftenable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/rotateleftenable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/rotaterightdisable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/rotaterightdisable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/rotaterightenable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/rotaterightenable.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/en/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/en/images/upload.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/images/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/zh-cn/images/copy.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/images/imglabel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/zh-cn/images/imglabel.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/images/localimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/zh-cn/images/localimage.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/images/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/zh-cn/images/music.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/lang/zh-cn/images/upload.png -------------------------------------------------------------------------------- /src/assets/umeditor/lang/zh-cn/zh-cn.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 中文语言包 3 | */ 4 | UM.I18N['zh-cn'] = { 5 | 'labelMap':{ 6 | 'anchor':'锚点', 'undo':'撤销', 'redo':'重做', 'bold':'加粗', 'indent':'首行缩进', 'snapscreen':'截图', 7 | 'italic':'斜体', 'underline':'下划线', 'strikethrough':'删除线', 'subscript':'下标','fontborder':'字符边框', 8 | 'superscript':'上标', 'formatmatch':'格式刷', 'source':'源代码', 'blockquote':'引用', 9 | 'pasteplain':'纯文本粘贴模式', 'selectall':'全选', 'print':'打印', 'preview':'预览', 10 | 'horizontal':'分隔线', 'removeformat':'清除格式', 'time':'时间', 'date':'日期', 11 | 'unlink':'取消链接', 'insertrow':'前插入行', 'insertcol':'前插入列', 'mergeright':'右合并单元格', 'mergedown':'下合并单元格', 12 | 'deleterow':'删除行', 'deletecol':'删除列', 'splittorows':'拆分成行', 'splittocols':'拆分成列', 'splittocells':'完全拆分单元格', 13 | 'mergecells':'合并多个单元格', 'deletetable':'删除表格', 'cleardoc':'清空文档','insertparagraphbeforetable':"表格前插入行",'insertcode':'代码语言','fontfamily':'字体', 'fontsize':'字号', 'paragraph':'段落格式', 'image':'图片', 14 | 'edittable':'表格属性','edittd':'单元格属性', 'link':'超链接','emotion':'表情', 'spechars':'特殊字符', 'searchreplace':'查询替换', 'map':'百度地图', 'gmap':'Google地图', 15 | 'video':'视频', 'help':'帮助', 'justifyleft':'居左对齐', 'justifyright':'居右对齐', 'justifycenter':'居中对齐', 16 | 'justifyjustify':'两端对齐', 'forecolor':'字体颜色', 'backcolor':'背景色', 'insertorderedlist':'有序列表', 17 | 'insertunorderedlist':'无序列表', 'fullscreen':'全屏', 'directionalityltr':'从左向右输入', 'directionalityrtl':'从右向左输入', 18 | 'rowspacingtop':'段前距', 'rowspacingbottom':'段后距', 'highlightcode':'插入代码', 'pagebreak':'分页', 'insertframe':'插入Iframe', 'imagenone':'默认', 19 | 'imageleft':'左浮动', 'imageright':'右浮动', 'attachment':'附件', 'imagecenter':'居中', 'wordimage':'图片转存', 20 | 'lineheight':'行间距','edittip' :'编辑提示','customstyle':'自定义标题', 'autotypeset':'自动排版', 'webapp':'百度应用', 21 | 'touppercase':'字母大写', 'tolowercase':'字母小写','background':'背景','template':'模板','scrawl':'涂鸦','music':'音乐','inserttable':'插入表格', 22 | 'drafts': '草稿箱', 'formula':'数学公式' 23 | 24 | 25 | }, 26 | 'paragraph':{'p':'段落', 'h1':'标题 1', 'h2':'标题 2', 'h3':'标题 3', 'h4':'标题 4', 'h5':'标题 5', 'h6':'标题 6'}, 27 | 'fontfamily':{ 28 | 'songti':'宋体', 29 | 'kaiti':'楷体', 30 | 'heiti':'黑体', 31 | 'lishu':'隶书', 32 | 'yahei':'微软雅黑', 33 | 'andaleMono':'andale mono', 34 | 'arial': 'arial', 35 | 'arialBlack':'arial black', 36 | 'comicSansMs':'comic sans ms', 37 | 'impact':'impact', 38 | 'timesNewRoman':'times new roman' 39 | }, 40 | 'ok':"确认", 41 | 'cancel':"取消", 42 | 'closeDialog':"关闭对话框", 43 | 'tableDrag':"表格拖动必须引入uiUtils.js文件!", 44 | 'autofloatMsg':"工具栏浮动依赖编辑器UI,您首先需要引入UI文件!", 45 | 'anthorMsg':"链接", 46 | 'clearColor':'清空颜色', 47 | 'standardColor':'标准颜色', 48 | 'themeColor':'主题颜色', 49 | 'property':'属性', 50 | 'default':'默认', 51 | 'modify':'修改', 52 | 'justifyleft':'左对齐', 53 | 'justifyright':'右对齐', 54 | 'justifycenter':'居中', 55 | 'justify':'默认', 56 | 'clear':'清除', 57 | 'anchorMsg':'锚点', 58 | 'delete':'删除', 59 | 'clickToUpload':"点击上传", 60 | 'unset':'尚未设置语言文件', 61 | 't_row':'行', 62 | 't_col':'列', 63 | 'more':'更多', 64 | 'pasteOpt':'粘贴选项', 65 | 'pasteSourceFormat':"保留源格式", 66 | 'tagFormat':'只保留标签', 67 | 'pasteTextFormat':'只保留文本', 68 | 69 | //===============dialog i18N======================= 70 | 'image':{ 71 | 'static':{ 72 | 'lang_tab_local':"本地上传", 73 | 'lang_tab_imgSearch':"网络图片", 74 | 'lang_input_dragTip':"支持图片拖拽上传", 75 | 'lang_btn_add':"添加" 76 | }, 77 | 'uploadError': '上传出错' 78 | }, 79 | 'emotion':{ 80 | 'static':{ 81 | 'lang_input_choice':'精选', 82 | 'lang_input_Tuzki':'兔斯基', 83 | 'lang_input_BOBO':'BOBO', 84 | 'lang_input_lvdouwa':'绿豆蛙', 85 | 'lang_input_babyCat':'baby猫', 86 | 'lang_input_bubble':'泡泡', 87 | 'lang_input_youa':'有啊' 88 | } 89 | }, 90 | 'gmap':{ 91 | 'static':{ 92 | 'lang_input_address':'地址', 93 | 'lang_input_search':'搜索', 94 | 'address':{'value':"北京"} 95 | }, 96 | 'searchError':'无法定位到该地址!' 97 | }, 98 | 'link':{ 99 | 'static':{ 100 | 'lang_input_text':'文本内容:', 101 | 'lang_input_url':'链接地址:', 102 | 'lang_input_title':'标题:', 103 | 'lang_input_target':'是否在新窗口打开:' 104 | }, 105 | 'validLink':'只支持选中一个链接时生效', 106 | 'httpPrompt':'您输入的超链接中不包含http等协议名称,默认将为您添加http://前缀' 107 | }, 108 | 'map':{ 109 | 'static':{ 110 | 'lang_city':"城市", 111 | 'lang_address':"地址", 112 | 'city':{'value':"北京"}, 113 | 'lang_search':"搜索", 114 | 'lang_dynamicmap':"插入动态地图" 115 | }, 116 | 'cityMsg':"请选择城市", 117 | 'errorMsg':"抱歉,找不到该位置!" 118 | }, 119 | 'video':{ 120 | 'static':{ 121 | 'lang_tab_insertV':"插入视频", 122 | 'lang_video_url':"视频网址", 123 | 'lang_video_size':"视频尺寸", 124 | 'lang_videoW':"宽度", 125 | 'lang_videoH':"高度", 126 | 'lang_alignment':"对齐方式", 127 | 'videoSearchTxt':{'value':"请输入搜索关键字!"}, 128 | 'videoType':{'options':["全部", "热门", "娱乐", "搞笑", "体育", "科技", "综艺"]}, 129 | 'videoSearchBtn':{'value':"百度一下"}, 130 | 'videoSearchReset':{'value':"清空结果"} 131 | }, 132 | 'numError':"请输入正确的数值,如123,400", 133 | 'floatLeft':"左浮动", 134 | 'floatRight':"右浮动", 135 | 'default':"默认", 136 | 'block':"独占一行", 137 | 'urlError':"输入的视频地址有误,请检查后再试!", 138 | 'loading':"  视频加载中,请等待……", 139 | 'clickToSelect':"点击选中", 140 | 'goToSource':'访问源视频', 141 | 'noVideo':"    抱歉,找不到对应的视频,请重试!" 142 | }, 143 | 'formula':{ 144 | 'static':{ 145 | 'lang_tab_common':'常用公式', 146 | 'lang_tab_symbol':'符号', 147 | 'lang_tab_letter':'字母' 148 | } 149 | } 150 | }; -------------------------------------------------------------------------------- /src/assets/umeditor/php/Uploader.class.php: -------------------------------------------------------------------------------- 1 | "文件大小超出 post_max_size 限制" , 28 | "SIZE" => "文件大小超出网站限制" , 29 | "TYPE" => "不允许的文件类型" , 30 | "DIR" => "目录创建失败" , 31 | "IO" => "输入输出错误" , 32 | "UNKNOWN" => "未知错误" , 33 | "MOVE" => "文件保存时出错", 34 | "DIR_ERROR" => "创建目录失败" 35 | ); 36 | 37 | /** 38 | * 构造函数 39 | * @param string $fileField 表单名称 40 | * @param array $config 配置项 41 | * @param bool $base64 是否解析base64编码,可省略。若开启,则$fileField代表的是base64编码的字符串表单名 42 | */ 43 | public function __construct( $fileField , $config , $base64 = false ) 44 | { 45 | $this->fileField = $fileField; 46 | $this->config = $config; 47 | $this->stateInfo = $this->stateMap[ 0 ]; 48 | $this->upFile( $base64 ); 49 | } 50 | 51 | /** 52 | * 上传文件的主处理方法 53 | * @param $base64 54 | * @return mixed 55 | */ 56 | private function upFile( $base64 ) 57 | { 58 | //处理base64上传 59 | if ( "base64" == $base64 ) { 60 | $content = $_POST[ $this->fileField ]; 61 | $this->base64ToImage( $content ); 62 | return; 63 | } 64 | 65 | //处理普通上传 66 | $file = $this->file = $_FILES[ $this->fileField ]; 67 | if ( !$file ) { 68 | $this->stateInfo = $this->getStateInfo( 'POST' ); 69 | return; 70 | } 71 | if ( $this->file[ 'error' ] ) { 72 | $this->stateInfo = $this->getStateInfo( $file[ 'error' ] ); 73 | return; 74 | } 75 | if ( !is_uploaded_file( $file[ 'tmp_name' ] ) ) { 76 | $this->stateInfo = $this->getStateInfo( "UNKNOWN" ); 77 | return; 78 | } 79 | 80 | $this->oriName = $file[ 'name' ]; 81 | $this->fileSize = $file[ 'size' ]; 82 | $this->fileType = $this->getFileExt(); 83 | 84 | if ( !$this->checkSize() ) { 85 | $this->stateInfo = $this->getStateInfo( "SIZE" ); 86 | return; 87 | } 88 | if ( !$this->checkType() ) { 89 | $this->stateInfo = $this->getStateInfo( "TYPE" ); 90 | return; 91 | } 92 | 93 | $folder = $this->getFolder(); 94 | 95 | if ( $folder === false ) { 96 | $this->stateInfo = $this->getStateInfo( "DIR_ERROR" ); 97 | return; 98 | } 99 | 100 | $this->fullName = $folder . '/' . $this->getName(); 101 | 102 | if ( $this->stateInfo == $this->stateMap[ 0 ] ) { 103 | if ( !move_uploaded_file( $file[ "tmp_name" ] , $this->fullName ) ) { 104 | $this->stateInfo = $this->getStateInfo( "MOVE" ); 105 | } 106 | } 107 | } 108 | 109 | /** 110 | * 处理base64编码的图片上传 111 | * @param $base64Data 112 | * @return mixed 113 | */ 114 | private function base64ToImage( $base64Data ) 115 | { 116 | $img = base64_decode( $base64Data ); 117 | $this->fileName = time() . rand( 1 , 10000 ) . ".png"; 118 | $this->fullName = $this->getFolder() . '/' . $this->fileName; 119 | if ( !file_put_contents( $this->fullName , $img ) ) { 120 | $this->stateInfo = $this->getStateInfo( "IO" ); 121 | return; 122 | } 123 | $this->oriName = ""; 124 | $this->fileSize = strlen( $img ); 125 | $this->fileType = ".png"; 126 | } 127 | 128 | /** 129 | * 获取当前上传成功文件的各项信息 130 | * @return array 131 | */ 132 | public function getFileInfo() 133 | { 134 | return array( 135 | "originalName" => $this->oriName , 136 | "name" => $this->fileName , 137 | "url" => $this->fullName , 138 | "size" => $this->fileSize , 139 | "type" => $this->fileType , 140 | "state" => $this->stateInfo 141 | ); 142 | } 143 | 144 | /** 145 | * 上传错误检查 146 | * @param $errCode 147 | * @return string 148 | */ 149 | private function getStateInfo( $errCode ) 150 | { 151 | return !$this->stateMap[ $errCode ] ? $this->stateMap[ "UNKNOWN" ] : $this->stateMap[ $errCode ]; 152 | } 153 | 154 | /** 155 | * 重命名文件 156 | * @return string 157 | */ 158 | private function getName() 159 | { 160 | return $this->fileName = time() . rand( 1 , 10000 ) . $this->getFileExt(); 161 | } 162 | 163 | /** 164 | * 文件类型检测 165 | * @return bool 166 | */ 167 | private function checkType() 168 | { 169 | return in_array( $this->getFileExt() , $this->config[ "allowFiles" ] ); 170 | } 171 | 172 | /** 173 | * 文件大小检测 174 | * @return bool 175 | */ 176 | private function checkSize() 177 | { 178 | return $this->fileSize <= ( $this->config[ "maxSize" ] * 1024 ); 179 | } 180 | 181 | /** 182 | * 获取文件扩展名 183 | * @return string 184 | */ 185 | private function getFileExt() 186 | { 187 | return strtolower( strrchr( $this->file[ "name" ] , '.' ) ); 188 | } 189 | 190 | /** 191 | * 按照日期自动创建存储文件夹 192 | * @return string 193 | */ 194 | private function getFolder() 195 | { 196 | $pathStr = $this->config[ "savePath" ]; 197 | if ( strrchr( $pathStr , "/" ) != "/" ) { 198 | $pathStr .= "/"; 199 | } 200 | $pathStr .= date( "Ymd" ); 201 | if ( !file_exists( $pathStr ) ) { 202 | if ( !mkdir( $pathStr , 0777 , true ) ) { 203 | return false; 204 | } 205 | } 206 | return $pathStr; 207 | } 208 | } -------------------------------------------------------------------------------- /src/assets/umeditor/php/getContent.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ".htmlspecialchars_decode($content)."
    "; 15 | -------------------------------------------------------------------------------- /src/assets/umeditor/php/imageUp.php: -------------------------------------------------------------------------------- 1 | "upload/" , //存储文件夹 9 | "maxSize" => 1000 , //允许的文件最大尺寸,单位KB 10 | "allowFiles" => array( ".gif" , ".png" , ".jpg" , ".jpeg" , ".bmp" ) //允许的文件格式 11 | ); 12 | //上传文件目录 13 | $Path = "upload/"; 14 | 15 | //背景保存在临时目录中 16 | $config[ "savePath" ] = $Path; 17 | $up = new Uploader( "upfile" , $config ); 18 | $type = $_REQUEST['type']; 19 | $callback=$_GET['callback']; 20 | 21 | $info = $up->getFileInfo(); 22 | /** 23 | * 返回数据 24 | */ 25 | if($callback) { 26 | echo ''; 27 | } else { 28 | echo json_encode($info); 29 | } 30 | -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/caret.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/caret.png -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/close.png -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/icons.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/icons.gif -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/icons.png -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/ok.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/ok.gif -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/pop-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/pop-bg.png -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/spacer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/spacer.gif -------------------------------------------------------------------------------- /src/assets/umeditor/themes/default/images/videologo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/themes/default/images/videologo.gif -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/Symbola.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/Symbola.eot -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/Symbola.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/Symbola.otf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/Symbola.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/Symbola.ttf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/Symbola.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/Symbola.woff -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/STIXFontLicense2010.txt: -------------------------------------------------------------------------------- 1 | STIX Font License 2 | 3 | 24 May 2010 4 | 5 | Copyright (c) 2001-2010 by the STI Pub Companies, consisting of the American 6 | Institute of Physics, the American Chemical Society, the American Mathematical 7 | Society, the American Physical Society, Elsevier, Inc., and The Institute of 8 | Electrical and Electronic Engineers, Inc. (www.stixfonts.org), with Reserved 9 | Font Name STIX Fonts, STIX Fonts (TM) is a trademark of The Institute of 10 | Electrical and Electronics Engineers, Inc. 11 | 12 | Portions copyright (c) 1998-2003 by MicroPress, Inc. (www.micropress-inc.com), 13 | with Reserved Font Name TM Math. To obtain additional mathematical fonts, please 14 | contact MicroPress, Inc., 68-30 Harrow Street, Forest Hills, NY 11375, USA, 15 | Phone: (718) 575-1816. 16 | 17 | Portions copyright (c) 1990 by Elsevier, Inc. 18 | 19 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 20 | This license is copied below, and is also available with a FAQ at: 21 | http://scripts.sil.org/OFL 22 | 23 | --------------------------------------------------------------------------- 24 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 25 | --------------------------------------------------------------------------- 26 | 27 | PREAMBLE 28 | 29 | The goals of the Open Font License (OFL) are to stimulate worldwide development 30 | of collaborative font projects, to support the font creation efforts of academic 31 | and linguistic communities, and to provide a free and open framework in which 32 | fonts may be shared and improved in partnership with others. 33 | 34 | The OFL allows the licensed fonts to be used, studied, modified and redistributed 35 | freely as long as they are not sold by themselves. The fonts, including any 36 | derivative works, can be bundled, embedded, redistributed and/or sold with any 37 | software provided that any reserved names are not used by derivative works. The 38 | fonts and derivatives, however, cannot be released under any other type of license. 39 | The requirement for fonts to remain under this license does not apply to any 40 | document created using the fonts or their derivatives. 41 | 42 | DEFINITIONS 43 | 44 | "Font Software" refers to the set of files released by the Copyright Holder(s) under 45 | this license and clearly marked as such. This may include source files, build 46 | scripts and documentation. 47 | 48 | "Reserved Font Name" refers to any names specified as such after the copyright 49 | statement(s). 50 | 51 | "Original Version" refers to the collection of Font Software components as 52 | distributed by the Copyright Holder(s). 53 | 54 | "Modified Version" refers to any derivative made by adding to, deleting, or 55 | substituting -- in part or in whole -- any of the components of the Original Version, 56 | by changing formats or by porting the Font Software to a new environment. 57 | 58 | "Author" refers to any designer, engineer, programmer, technical writer or other 59 | person who contributed to the Font Software. 60 | 61 | PERMISSION & CONDITIONS 62 | 63 | Permission is hereby granted, free of charge, to any person obtaining a copy of the 64 | Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell 65 | modified and unmodified copies of the Font Software, subject to the following 66 | conditions: 67 | 68 | 1) Neither the Font Software nor any of its individual components, in Original or 69 | Modified Versions, may be sold by itself. 70 | 71 | 2) Original or Modified Versions of the Font Software may be bundled, redistributed 72 | and/or sold with any software, provided that each copy contains the above copyright 73 | notice and this license. These can be included either as stand-alone text files, 74 | human-readable headers or in the appropriate machine-readable metadata fields within 75 | text or binary files as long as those fields can be easily viewed by the user. 76 | 77 | 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless 78 | explicit written permission is granted by the corresponding Copyright Holder. This 79 | restriction only applies to the primary font name as presented to the users. 80 | 81 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall 82 | not be used to promote, endorse or advertise any Modified Version, except to 83 | acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with 84 | their explicit written permission. 85 | 86 | 5) The Font Software, modified or unmodified, in part or in whole, must be distributed 87 | entirely under this license, and must not be distributed under any other license. The 88 | requirement for fonts to remain under this license does not apply to any document 89 | created using the Font Software. 90 | 91 | TERMINATION 92 | 93 | This license becomes null and void if any of the above conditions are not met. 94 | 95 | DISCLAIMER 96 | 97 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 98 | INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 99 | PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER 100 | RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 101 | LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, 102 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR 103 | INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. 104 | -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.eot -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.ttf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneral-webfont.woff -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.eot -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.ttf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbol-webfont.woff -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.eot -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.ttf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralbolita-webfont.woff -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.eot -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.ttf -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cipchk/ngx-umeditor/91315eccf2a704ced9002792f397bd131172b8ce/src/assets/umeditor/third-party/mathquill/font/stixgeneral-bundle/stixgeneralitalic-webfont.woff -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/mathquill/mathquill.css: -------------------------------------------------------------------------------- 1 | /* 2 | * LaTeX Math in pure HTML and CSS -- No images whatsoever 3 | * v0.xa 4 | * by Jay and Han 5 | * Lesser GPL Licensed: http: //www.gnu.org/licenses/lgpl.html 6 | * 7 | * This file is automatically included by mathquill.js 8 | * 9 | */ 10 | @font-face { 11 | font-family: Symbola; 12 | src: url(font/Symbola.eot); 13 | src: local("Symbola Regular"), local("Symbola"), url(font/Symbola.ttf) format("truetype"), url(font/Symbola.otf) format("opentype"), url(font/Symbola.svg#Symbola) format("svg"); 14 | } 15 | .mathquill-editable { 16 | display: -moz-inline-box; 17 | display: inline-block; 18 | white-space: pre-wrap; 19 | } 20 | .mathquill-editable .cursor { 21 | border-left: 1px solid black; 22 | margin-right: -1px; 23 | position: relative; 24 | z-index: 1; 25 | padding: 0; 26 | display: -moz-inline-box; 27 | display: inline-block; 28 | } 29 | .mathquill-editable .cursor.blink { 30 | visibility: hidden; 31 | } 32 | .mathquill-editable, 33 | .mathquill-embedded-latex .mathquill-editable { 34 | border: 1px solid gray; 35 | padding: 2px; 36 | } 37 | .mathquill-embedded-latex .mathquill-editable { 38 | margin: 1px; 39 | } 40 | .mathquill-editable.hasCursor, 41 | .mathquill-editable .hasCursor { 42 | -webkit-box-shadow: #68b4df 0 0 3px 2px; 43 | -moz-box-shadow: #68b4df 0 0 3px 2px; 44 | box-shadow: #68b4df 0 0 3px 2px; 45 | } 46 | .mathquill-editable .latex-command-input { 47 | color: inherit; 48 | font-family: "Courier New", monospace; 49 | border: 1px solid gray; 50 | padding-right: 1px; 51 | margin-right: 1px; 52 | margin-left: 2px; 53 | } 54 | .mathquill-editable .latex-command-input.empty { 55 | background: transparent; 56 | } 57 | .mathquill-editable .latex-command-input.hasCursor { 58 | border-color: ActiveBorder; 59 | } 60 | .mathquill-editable.empty:after, 61 | .mathquill-textbox:after, 62 | .mathquill-rendered-math .empty:after { 63 | visibility: hidden; 64 | content: 'c'; 65 | } 66 | .mathquill-editable .cursor:only-child:after, 67 | .mathquill-editable .textarea + .cursor:last-child:after { 68 | visibility: hidden; 69 | content: 'c'; 70 | } 71 | .mathquill-textbox { 72 | overflow-x: auto; 73 | overflow-y: hidden; 74 | } 75 | .mathquill-rendered-math { 76 | font-variant: normal; 77 | font-weight: normal; 78 | font-style: normal; 79 | font-size: 115%; 80 | line-height: 1; 81 | display: -moz-inline-box; 82 | display: inline-block; 83 | } 84 | .mathquill-rendered-math .non-leaf, 85 | .mathquill-rendered-math .scaled { 86 | display: -moz-inline-box; 87 | display: inline-block; 88 | } 89 | .mathquill-rendered-math var, 90 | .mathquill-rendered-math .text, 91 | .mathquill-rendered-math .nonSymbola { 92 | font-family: "Times New Roman", Symbola, serif; 93 | line-height: .9; 94 | } 95 | .mathquill-rendered-math * { 96 | font-size: inherit; 97 | line-height: inherit; 98 | margin: 0; 99 | padding: 0; 100 | border-color: black; 101 | -webkit-user-select: none; 102 | -moz-user-select: none; 103 | user-select: none; 104 | } 105 | .mathquill-rendered-math .empty { 106 | background: #ccc; 107 | } 108 | .mathquill-rendered-math.empty { 109 | background: transparent; 110 | } 111 | .mathquill-rendered-math .text { 112 | font-size: 87%; 113 | } 114 | .mathquill-rendered-math .font { 115 | font: 1em "Times New Roman", Symbola, serif; 116 | } 117 | .mathquill-rendered-math .font * { 118 | font-family: inherit; 119 | font-style: inherit; 120 | } 121 | .mathquill-rendered-math b, 122 | .mathquill-rendered-math b.font { 123 | font-weight: bolder; 124 | } 125 | .mathquill-rendered-math var, 126 | .mathquill-rendered-math i, 127 | .mathquill-rendered-math i.font { 128 | font-syle: italic; 129 | } 130 | .mathquill-rendered-math var.florin { 131 | margin: 0 -0.1em; 132 | } 133 | .mathquill-rendered-math big { 134 | font-size: 125%; 135 | } 136 | .mathquill-rendered-math .roman { 137 | font-style: normal; 138 | } 139 | .mathquill-rendered-math .sans-serif { 140 | font-family: sans-serif, Symbola, serif; 141 | } 142 | .mathquill-rendered-math .monospace { 143 | font-family: monospace, Symbola, serif; 144 | } 145 | .mathquill-rendered-math .overline { 146 | border-top: 1px solid black; 147 | margin-top: 1px; 148 | } 149 | .mathquill-rendered-math .underline { 150 | border-bottom: 1px solid black; 151 | margin-bottom: 1px; 152 | } 153 | .mathquill-rendered-math .binary-operator { 154 | padding: 0 0.2em; 155 | display: -moz-inline-box; 156 | display: inline-block; 157 | } 158 | .mathquill-rendered-math .unary-operator { 159 | padding-left: 0.2em; 160 | } 161 | .mathquill-rendered-math sup, 162 | .mathquill-rendered-math sub { 163 | position: relative; 164 | font-size: 90%; 165 | } 166 | .mathquill-rendered-math sup .binary-operator, 167 | .mathquill-rendered-math sub .binary-operator { 168 | padding: 0 .1em; 169 | } 170 | .mathquill-rendered-math sup .unary-operator, 171 | .mathquill-rendered-math sub .unary-operator { 172 | padding-left: .1em; 173 | } 174 | .mathquill-rendered-math sup.limit, 175 | .mathquill-rendered-math sub.limit, 176 | .mathquill-rendered-math sup.nthroot, 177 | .mathquill-rendered-math sub.nthroot { 178 | font-size: 80%; 179 | } 180 | .mathquill-rendered-math sup .fraction, 181 | .mathquill-rendered-math sub .fraction { 182 | font-size: 70%; 183 | vertical-align: -0.4em; 184 | } 185 | .mathquill-rendered-math sup .numerator, 186 | .mathquill-rendered-math sub .numerator { 187 | padding-bottom: 0; 188 | } 189 | .mathquill-rendered-math sup .denominator, 190 | .mathquill-rendered-math sub .denominator { 191 | padding-top: 0; 192 | } 193 | .mathquill-rendered-math sup { 194 | vertical-align: .5em; 195 | } 196 | .mathquill-rendered-math sup.limit, 197 | .mathquill-rendered-math sup.nthroot { 198 | vertical-align: 0.8em; 199 | } 200 | .mathquill-rendered-math sup.nthroot { 201 | margin-right: -0.6em; 202 | margin-left: .2em; 203 | min-width: .5em; 204 | } 205 | .mathquill-rendered-math sub { 206 | vertical-align: -0.4em; 207 | } 208 | .mathquill-rendered-math sub.limit { 209 | vertical-align: -0.6em; 210 | } 211 | .mathquill-rendered-math .paren { 212 | padding: 0 .1em; 213 | vertical-align: bottom; 214 | -webkit-transform-origin: bottom center; 215 | -moz-transform-origin: bottom center; 216 | -ms-transform-origin: bottom center; 217 | -o-transform-origin: bottom center; 218 | transform-origin: bottom center; 219 | } 220 | .mathquill-rendered-math .array { 221 | vertical-align: middle; 222 | text-align: center; 223 | } 224 | .mathquill-rendered-math .array > span { 225 | display: block; 226 | } 227 | .mathquill-rendered-math .non-italicized-function { 228 | font-family: Symbola, "Times New Roman", serif; 229 | line-height: .9; 230 | font-style: normal; 231 | padding-right: .2em; 232 | } 233 | .mathquill-rendered-math .fraction { 234 | font-size: 90%; 235 | text-align: center; 236 | vertical-align: -0.5em; 237 | padding: 0 .2em; 238 | } 239 | .mathquill-rendered-math .fraction, 240 | .mathquill-rendered-math x:-moz-any-link { 241 | display: -moz-groupbox; 242 | } 243 | .mathquill-rendered-math .fraction, 244 | .mathquill-rendered-math x:-moz-any-link, 245 | .mathquill-rendered-math x:default { 246 | display: inline-block; 247 | } 248 | .mathquill-rendered-math .numerator, 249 | .mathquill-rendered-math .denominator { 250 | display: block; 251 | } 252 | .mathquill-rendered-math .numerator { 253 | padding: 0 0.1em; 254 | margin-bottom: -0.1em; 255 | } 256 | .mathquill-rendered-math .denominator { 257 | border-top: 1px solid; 258 | float: right; 259 | width: 100%; 260 | padding: .1em .1em 0 .1em; 261 | margin-right: -0.1em; 262 | margin-left: -0.1em; 263 | } 264 | .mathquill-rendered-math .sqrt-prefix { 265 | padding-top: 0; 266 | position: relative; 267 | top: .1em; 268 | vertical-align: top; 269 | -webkit-transform-origin: top; 270 | -moz-transform-origin: top; 271 | -ms-transform-origin: top; 272 | -o-transform-origin: top; 273 | transform-origin: top; 274 | } 275 | .mathquill-rendered-math .sqrt-stem { 276 | border-top: 1px solid; 277 | margin-top: 1px; 278 | padding-left: .15em; 279 | padding-right: .2em; 280 | margin-right: .1em; 281 | } 282 | .mathquill-rendered-math .vector-prefix { 283 | display: block; 284 | text-align: center; 285 | line-height: .25em; 286 | margin-bottom: -0.1em; 287 | font-size: 0.75em; 288 | } 289 | .mathquill-rendered-math .vector-stem { 290 | display: block; 291 | } 292 | .mathquill-rendered-math, 293 | .mathquill-rendered-math .mathquill-editable { 294 | cursor: text; 295 | font-family: Symbola, "Times New Roman", serif; 296 | } 297 | .mathquill-rendered-math .selection, 298 | .mathquill-editable .selection, 299 | .mathquill-rendered-math .selection .non-leaf, 300 | .mathquill-editable .selection .non-leaf, 301 | .mathquill-rendered-math .selection .scaled, 302 | .mathquill-editable .selection .scaled { 303 | background: #B4D5FE !important; 304 | background: Highlight !important; 305 | color: HighlightText; 306 | border-color: HighlightText; 307 | } 308 | .mathquill-rendered-math .selection .matrixed, 309 | .mathquill-editable .selection .matrixed { 310 | background: #39F !important; 311 | } 312 | .mathquill-rendered-math .selection .matrixed-container, 313 | .mathquill-editable .selection .matrixed-container { 314 | filter: progid:DXImageTransform.Microsoft.Chroma(color='#3399FF') !important; 315 | } 316 | .mathquill-rendered-math .selection.blur, 317 | .mathquill-editable .selection.blur, 318 | .mathquill-rendered-math .selection.blur .non-leaf, 319 | .mathquill-editable .selection.blur .non-leaf, 320 | .mathquill-rendered-math .selection.blur .scaled, 321 | .mathquill-editable .selection.blur .scaled, 322 | .mathquill-rendered-math .selection.blur .matrixed, 323 | .mathquill-editable .selection.blur .matrixed { 324 | background: #D4D4D4 !important; 325 | color: black; 326 | border-color: black; 327 | } 328 | .mathquill-rendered-math .selection.blur .matrixed-container, 329 | .mathquill-editable .selection.blur .matrixed-container { 330 | filter: progid:DXImageTransform.Microsoft.Chroma(color='#D4D4D4') !important; 331 | } 332 | .mathquill-editable .textarea, 333 | .mathquill-rendered-math .textarea { 334 | position: relative; 335 | -webkit-user-select: text; 336 | -moz-user-select: text; 337 | user-select: text; 338 | } 339 | .mathquill-editable .textarea textarea, 340 | .mathquill-rendered-math .textarea textarea, 341 | .mathquill-editable .selectable, 342 | .mathquill-rendered-math .selectable { 343 | -webkit-user-select: text; 344 | -moz-user-select: text; 345 | user-select: text; 346 | position: absolute; 347 | clip: rect(1em 1em 1em 1em); 348 | } 349 | .mathquill-rendered-math .matrixed { 350 | background: white; 351 | display: -moz-inline-box; 352 | display: inline-block; 353 | } 354 | .mathquill-rendered-math .matrixed-container { 355 | filter: progid:DXImageTransform.Microsoft.Chroma(color='white'); 356 | margin-top: -0.1em; 357 | } 358 | -------------------------------------------------------------------------------- /src/assets/umeditor/third-party/template.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ETPL (Enterprise Template) 3 | * Copyright 2013 Baidu Inc. All rights reserved. 4 | * 5 | * @file 模板引擎 6 | * @author errorrik(errorrik@gmail.com) 7 | * otakustay(otakustay@gmail.com) 8 | */ 9 | !function(t){function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function n(){this.raw=[],this.length=0}function r(){return"___"+I++}function i(t,n){var r=t.prototype,i=new Function;i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t,e(t.prototype,r)}function o(t){return D[t]}function s(t){return'"'+t.replace(/\x5C/g,"\\\\").replace(/"/g,'\\"').replace(/\x0A/g,"\\n").replace(/\x09/g,"\\t").replace(/\x0D/g,"\\r")+'"'}function a(t){return t.replace(/[\^\[\]\$\(\)\{\}\?\*\.\+]/g,function(t){return"\\"+t})}function p(t){var e=arguments;return t.replace(/\{([0-9]+)\}/g,function(t,n){return e[n-0+1]})}function h(t){return t=t.replace(/^\s*\*/,""),p('gv({0},["{1}"])',s(t),t.replace(/\[['"]?([^'"]+)['"]?\]/g,function(t,e){return"."+e}).split(".").join('","'))}function c(t,e,n,r,i,o){for(var s=n.length,a=t.split(e),p=0,h=[],c=0,l=a.length;l>c;c++){var u=a[c];if(c){var f=1;for(p++;;){var d=u.indexOf(n);if(0>d){h.push(p>1&&f?e:"",u);break}if(p=r?p-1:0,h.push(p>0&&f?e:"",u.slice(0,d),p>0?n:""),u=u.slice(d+s),f=0,0===p)break}0===p&&(i(h.join("")),o(u),h=[])}else u&&o(u)}p>0&&h.length>0&&(o(e),o(h.join("")))}function l(t,e,n){var r,i=[],o=e.options,a="",p="",u="",f="";return n&&(a="ts(",p=")",u=S,f=z,r=o.defaultFilter),c(t,o.variableOpen,o.variableClose,1,function(t){n&&t.indexOf("|")<0&&r&&(t+="|"+r);var o=t.indexOf("|"),s=(o>0?t.slice(0,o):t).replace(/^\s+/,"").replace(/\s+$/,""),c=o>0?t.slice(o+1):"",d=0===s.indexOf("*"),g=[d?"":a,h(s),d?"":p];if(c){c=l(c,e);for(var y=c.split("|"),v=0,m=y.length;m>v;v++){var w=y[v],R=w.match(/^\s*([a-z0-9_-]+)(\((.*)\))?\s*$/i);R&&(g.unshift('fs["'+R[1]+'"]('),R[3]&&g.push(",",R[3]),g.push(")"))}}i.push(u,g.join(""),f)},function(t){i.push(u,n?s(t):t,f)}),i.join("")}function u(t,e){this.value=t,this.engine=e}function f(t,e){this.value=t,this.engine=e,this.children=[],this.cloneProps=[]}function d(t,e){var n=t.stack,r=e?n.find(function(t){return t instanceof e}):n.bottom();if(r){for(var i;(i=n.top())!==r;){if(!i.autoClose)throw new Error(i.type+" must be closed manually: "+i.value);i.autoClose(t)}r.close(t)}return r}function g(t,e){var n=t.match(/^\s*([a-z0-9\/\._-]+)\s*(\(\s*master\s*=\s*([a-z0-9\/\._-]+)\s*\))?\s*/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.master=n[3],this.name=n[1],f.call(this,t,e),this.blocks={}}function y(t,e){var n=t.match(/^\s*([a-z0-9\/\._-]+)\s*$/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.name=n[1],f.call(this,t,e),this.cloneProps=["name"]}function v(t,e){var n=t.match(/^\s*([a-z0-9\/\._-]+)\s*$/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.name=n[1],f.call(this,t,e),this.cloneProps=["name","state","blocks","target"],this.blocks={}}function m(t,e){var n=t.match(/^\s*([a-z0-9_]+)\s*=([\s\S]*)$/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.name=n[1],this.expr=n[2],f.call(this,t,e),this.cloneProps=["name","expr"]}function w(t,e){var n=t.match(/^\s*([a-z0-9_-]+)\s*(\(([\s\S]*)\))?\s*$/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.name=n[1],this.args=n[3],f.call(this,t,e),this.cloneProps=["name","args"]}function R(t,e){var n=t.match(/^\s*([a-z0-9\/\._-]+)\s*(\(([\s\S]*)\))?\s*$/i);if(!n)throw new Error("Invalid "+this.type+" syntax: "+t);this.name=n[1],this.args=n[3],f.call(this,t,e),this.cloneProps=["name","args"]}function E(t,e){var n=new RegExp(p("^\\s*({0}[\\s\\S]+{1})\\s+as\\s+{0}([0-9a-z_]+){1}\\s*(,\\s*{0}([0-9a-z_]+){1})?\\s*$",a(e.options.variableOpen),a(e.options.variableClose)),"i"),r=t.match(n);if(!r)throw new Error("Invalid "+this.type+" syntax: "+t);this.list=r[1],this.item=r[2],this.index=r[4],f.call(this,t,e),this.cloneProps=["list","item","index"]}function b(t,e){f.call(this,t,e)}function x(t,e){b.call(this,t,e)}function k(t,e){f.call(this,t,e)}function A(t,e){e.target=t;var n=e.engine,r=t.name;if(n.targets[r])switch(n.options.namingConflict){case"override":n.targets[r]=t,e.targets.push(r);case"ignore":break;default:throw new Error("[ETPL_TARGET_EXISTS]"+r)}else n.targets[r]=t,e.targets.push(r)}function C(t,e,n){t.commandTypes[e]=n,n.prototype.type=e}function P(t){this.options={commandOpen:"",commandSyntax:/^\s*(\/)?([a-z]*)\s*(?::([\s\S]*))?$/,variableOpen:"${",variableClose:"}",defaultFilter:"html"},this.commandTypes={},C(this,"target",g),C(this,"block",y),C(this,"import",v),C(this,"use",R),C(this,"var",m),C(this,"for",E),C(this,"if",b),C(this,"elif",x),C(this,"else",k),C(this,"filter",w),this.config(t),this.targets={},this.filters=e({},B)}function _(t,e){function r(){var t;if(l.length>0&&(t=l.join(""))){var n=new u(t,e);n.beforeAdd(h),p.top().addChild(n),l=[],e.options.strip&&h.current instanceof f&&(n.value=t.replace(/^[\x20\t\r]*\n/,"")),h.current=n}}var i,o=e.options.commandOpen,s=e.options.commandClose,a=e.options.commandSyntax,p=new n,h={engine:e,targets:[],stack:p,target:null,deps:{}},l=[];c(t,o,s,0,function(t){var n,p=a.exec(t);if(p&&(n=p[2]||"target")&&(i=e.commandTypes[n.toLowerCase()])&&"function"==typeof i){r();var c=h.current;e.options.strip&&c instanceof u&&(c.value=c.value.replace(/\r?\n[\x20\t]*$/,"\n")),p[1]?c=d(h,i):(c=new i(p[3],e),"function"==typeof c.init&&c.init(h),c.beforeOpen(h),c.open(h)),h.current=c}else/^\s*\/\//.test(t)||l.push(o,t,s);i=null},function(t){l.push(t)}),r(),d(h);var g=[];for(var y in h.deps)g.push(y);return{targets:h.targets,deps:g}}n.prototype={push:function(t){this.raw[this.length++]=t},pop:function(){if(this.length>0){var t=this.raw[--this.length];return this.raw.length=this.length,t}},top:function(){return this.raw[this.length-1]},bottom:function(){return this.raw[0]},find:function(t){for(var e=this.length;e--;){var n=this.raw[e];if(t(n))return n}}};var I=178245,D={"&":"&","<":"<",">":">",'"':""","'":"'"},B={html:function(t){return t.replace(/[&<>"']/g,o)},url:encodeURIComponent,raw:function(t){return t}},T='var r="";',S="r+=",z=";",O="return r;",$="undefined"!=typeof navigator&&navigator.userAgent.match(/msie\s*([0-9]+)/i);$&&$[1]-0<8&&(T="var r=[],ri=0;",S="r[ri++]=",O='return r.join("");'),u.prototype={getRendererBody:function(){var t=this.value,e=this.engine.options;return!t||e.strip&&/^\s*$/.test(t)?"":l(t,this.engine,1)},clone:function(){return this}},f.prototype={addChild:function(t){this.children.push(t)},open:function(t){var e=t.stack.top();e&&e.addChild(this),t.stack.push(this)},close:function(t){t.stack.top()===this&&t.stack.pop()},getRendererBody:function(){for(var t=[],e=this.children,n=0;nn;n++)e.addChild(this.children[n].clone());for(var n=0,r=this.cloneProps.length;r>n;n++){var i=this.cloneProps[n];e[i]=this[i]}return e}};var j='data=data||{};var v={},fs=engine.filters,hg=typeof data.get=="function",gv=function(n,ps){var p=ps[0],d=v[p];if(d==null){if(hg){return data.get(n);}d=data[p];}for(var i=1,l=ps.length;ii;i++){var s=r[i];s instanceof y&&n[s.name]&&(s=r[i]=n[s.name]),e(s)}}if(this.state>=L.APPLIED)return 1;var n=this.blocks,r=this.engine.targets[t];if(r){if(r.applyMaster(r.master))return this.children=r.clone().children,e(this),this.state=L.APPLIED,1}else if("error"===this.engine.options.missTarget)throw new Error("[ETPL_MISS_TARGET]"+t+", when extended by "+(this.target?this.target.name:this.name))},g.prototype.isReady=function(){function t(i){for(var o=0,s=i.children.length;s>o;o++){var a=i.children[o];if(a instanceof v){var p=e.targets[a.name];if(!p&&"error"===e.options.missTarget)throw new Error("[ETPL_MISS_TARGET]"+a.name+", when imported by "+n);r=r&&p&&p.isReady(e)}else a instanceof f&&t(a)}}if(this.state>=L.READY)return 1;var e=this.engine,n=this.name,r=1;return this.applyMaster(this.master)?(t(this),r&&(this.state=L.READY),r):void 0},g.prototype.getRenderer=function(){if(this.renderer)return this.renderer;if(this.isReady()){var t=new Function("data","engine",[j,T,this.getRendererBody(),O].join("\n")),e=this.engine;return this.renderer=function(n){return t(n,e)},this.renderer}return null},g.prototype.open=function(t){d(t),f.prototype.open.call(this,t),this.state=L.READING,A(this,t)},m.prototype.open=R.prototype.open=function(t){t.stack.top().addChild(this)},y.prototype.open=function(t){f.prototype.open.call(this,t),t.stack.find(function(t){return t.blocks}).blocks[this.name]=this},x.prototype.open=function(t){var e=new k;e.open(t);var n=d(t,b);n.addChild(this),t.stack.push(this)},k.prototype.open=function(t){var e=d(t,b);e.addChild(this),t.stack.push(this)},v.prototype.open=function(t){this.parent=t.stack.top(),this.target=t.target,f.prototype.open.call(this,t),this.state=L.READING},R.prototype.close=m.prototype.close=function(){},v.prototype.close=function(t){f.prototype.close.call(this,t),this.state=L.READED},g.prototype.close=function(t){f.prototype.close.call(this,t),this.state=this.master?L.READED:L.APPLIED,t.target=null},v.prototype.autoClose=function(t){var e=this.parent.children;e.push.apply(e,this.children),this.children.length=0;for(var n in this.blocks)this.target.blocks[n]=this.blocks[n];this.blocks={},this.close(t)},f.prototype.beforeOpen=u.prototype.beforeAdd=function(t){if(!t.stack.bottom()){var e=new g(r(),t.engine);e.open(t)}},g.prototype.beforeOpen=function(){},v.prototype.getRendererBody=function(){return this.applyMaster(this.name),f.prototype.getRendererBody.call(this)},R.prototype.getRendererBody=function(){return p("{0}engine.render({2},{{3}}){1}",S,z,s(this.name),l(this.args,this.engine).replace(/(^|,)\s*([a-z0-9_]+)\s*=/gi,function(t,e,n){return(e||"")+s(n)+":"}))},m.prototype.getRendererBody=function(){return this.expr?p("v[{0}]={1};",s(this.name),l(this.expr,this.engine)):""},b.prototype.getRendererBody=function(){return p("if({0}){{1}}",l(this.value,this.engine),f.prototype.getRendererBody.call(this))},k.prototype.getRendererBody=function(){return p("}else{{0}",f.prototype.getRendererBody.call(this))},E.prototype.getRendererBody=function(){return p('var {0}={1};if({0} instanceof Array)for (var {4}=0,{5}={0}.length;{4}<{5};{4}++){v[{2}]={4};v[{3}]={0}[{4}];{6}}else if(typeof {0}==="object")for(var {4} in {0}){v[{2}]={4};v[{3}]={0}[{4}];{6}}',r(),l(this.list,this.engine),s(this.index||r()),s(this.item),r(),r(),f.prototype.getRendererBody.call(this))},w.prototype.getRendererBody=function(){var t=this.args;return p("{2}fs[{5}]((function(){{0}{4}{1}})(){6}){3}",T,O,S,z,f.prototype.getRendererBody.call(this),s(this.name),t?","+l(t,this.engine):"")},P.prototype.config=function(t){e(this.options,t)},P.prototype.compile=P.prototype.parse=function(t){var e=new Function('return ""');if(t){var n=_(t,this),r=n.targets;r.length&&(e=this.targets[r[0]].getRenderer())}return e},P.prototype.getRenderer=function(t){var e=this.targets[t];return e?e.getRenderer():void 0},P.prototype.render=function(t,e){var n=this.getRenderer(t);return n?n(e):""},P.prototype.addCommand=function(t,e){var n=e;"function"!=typeof n&&(n=function(t,e){f.call(this,t,e)},n.prototype=e),i(n,f),C(this,t,n)},P.prototype.addFilter=function(t,e){"function"==typeof e&&(this.filters[t]=e)};var F=new P;F.Engine=P,F.version="3.2.0",F.Command=f,F.util={inherits:i,stringFormat:p,stringLiteralize:s,compileVariable:l,parseSource:_},"object"==typeof exports&&"object"==typeof module?exports=module.exports=F:"function"==typeof define&&define.amd?define(F):t.etpl=F}(this); -------------------------------------------------------------------------------- /src/assets/umeditor/umeditor.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * umeditor完整配置项 3 | * 可以在这里配置整个编辑器的特性 4 | */ 5 | /**************************提示******************************** 6 | * 所有被注释的配置项均为UEditor默认值。 7 | * 修改默认配置请首先确保已经完全明确该参数的真实用途。 8 | * 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。 9 | * 当升级编辑器时,可直接使用旧版配置文件替换新版配置文件,不用担心旧版配置文件中因缺少新功能所需的参数而导致脚本报错。 10 | **************************提示********************************/ 11 | 12 | etpl.config({ 13 | commandOpen: '<%', 14 | commandClose: '%>' 15 | }); 16 | 17 | (function () { 18 | /** 19 | * 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。 20 | * 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。 21 | * "相对于网站根目录的相对路径"也就是以斜杠开头的形如"/myProject/umeditor/"这样的路径。 22 | * 如果站点中有多个不在同一层级的页面需要实例化编辑器,且引用了同一UEditor的时候,此处的URL可能不适用于每个页面的编辑器。 23 | * 因此,UEditor提供了针对不同页面的编辑器可单独配置的根路径,具体来说,在需要实例化编辑器的页面最顶部写上如下代码即可。当然,需要令此处的URL等于对应的配置。 24 | * window.UMEDITOR_HOME_URL = "/xxxx/xxxx/"; 25 | */ 26 | var URL = window.UMEDITOR_HOME_URL || (function(){ 27 | 28 | function PathStack() { 29 | 30 | this.documentURL = self.document.URL || self.location.href; 31 | 32 | this.separator = '/'; 33 | this.separatorPattern = /\\|\//g; 34 | this.currentDir = './'; 35 | this.currentDirPattern = /^[.]\/]/; 36 | 37 | this.path = this.documentURL; 38 | this.stack = []; 39 | 40 | this.push( this.documentURL ); 41 | 42 | } 43 | 44 | PathStack.isParentPath = function( path ){ 45 | return path === '..'; 46 | }; 47 | 48 | PathStack.hasProtocol = function( path ){ 49 | return !!PathStack.getProtocol( path ); 50 | }; 51 | 52 | PathStack.getProtocol = function( path ){ 53 | 54 | var protocol = /^[^:]*:\/*/.exec( path ); 55 | 56 | return protocol ? protocol[0] : null; 57 | 58 | }; 59 | 60 | PathStack.prototype = { 61 | push: function( path ){ 62 | 63 | this.path = path; 64 | 65 | update.call( this ); 66 | parse.call( this ); 67 | 68 | return this; 69 | 70 | }, 71 | getPath: function(){ 72 | return this + ""; 73 | }, 74 | toString: function(){ 75 | return this.protocol + ( this.stack.concat( [''] ) ).join( this.separator ); 76 | } 77 | }; 78 | 79 | function update() { 80 | 81 | var protocol = PathStack.getProtocol( this.path || '' ); 82 | 83 | if( protocol ) { 84 | 85 | //根协议 86 | this.protocol = protocol; 87 | 88 | //local 89 | this.localSeparator = /\\|\//.exec( this.path.replace( protocol, '' ) )[0]; 90 | 91 | this.stack = []; 92 | } else { 93 | protocol = /\\|\//.exec( this.path ); 94 | protocol && (this.localSeparator = protocol[0]); 95 | } 96 | 97 | } 98 | 99 | function parse(){ 100 | 101 | var parsedStack = this.path.replace( this.currentDirPattern, '' ); 102 | 103 | if( PathStack.hasProtocol( this.path ) ) { 104 | parsedStack = parsedStack.replace( this.protocol , ''); 105 | } 106 | 107 | parsedStack = parsedStack.split( this.localSeparator ); 108 | parsedStack.length = parsedStack.length - 1; 109 | 110 | for(var i= 0,tempPath,l=parsedStack.length,root = this.stack;i 0.5% 6 | last 2 versions 7 | Firefox ESR 8 | not dead 9 | # IE 9-11 -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ngx-umeditor | Angular for Baidu UMeditor 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
    17 | Loading... 18 |
    19 | 20 | Fork me on GitHub 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { environment } from './environments/environment'; 5 | import { AppModule } from './app/app.module'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule); 12 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Required to support Web Animations `@angular/platform-browser/animations`. 51 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 52 | **/ 53 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 54 | 55 | 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | 64 | /*************************************************************************************************** 65 | * APPLICATION IMPORTS 66 | */ 67 | 68 | /** 69 | * Date, currency, decimal and percent pipes. 70 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 71 | */ 72 | // import 'intl'; // Run `npm install --save intl`. 73 | /** 74 | * Need to import at least one locale-data with intl. 75 | */ 76 | // import 'intl/locale-data/jsonp/en'; 77 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | button + button { 3 | margin-left: 8px; 4 | } 5 | -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false, 5 | "outDir": "../out-tsc/app", 6 | "baseUrl": "./", 7 | "module": "es2015", 8 | "types": [], 9 | "paths": { 10 | "ngx-umeditor": ["../lib/index"], 11 | "ngx-umeditor/*": ["../lib/*"] 12 | } 13 | }, 14 | "exclude": ["test.ts", "**/*.spec.ts"] 15 | } 16 | -------------------------------------------------------------------------------- /src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig-build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./publish/src", 5 | "baseUrl": "./", 6 | "declaration": true, 7 | "importHelpers": true, 8 | "module": "es2015", 9 | "sourceMap": true, 10 | "target": "es2015", 11 | "types": [ 12 | "node" 13 | ] 14 | }, 15 | "files": [ 16 | "./__gen_lib/public_api.ts" 17 | ], 18 | "angularCompilerOptions": { 19 | "annotateForClosureCompiler": true, 20 | "strictMetadataEmit": true, 21 | "skipTemplateCodegen": true, 22 | "flatModuleOutFile": "index.js", 23 | "flatModuleId": "ngx-umeditor" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": ["node_modules/@types"], 12 | "lib": ["es2017", "dom"], 13 | "baseUrl": "./", 14 | "paths": { 15 | "ngx-umeditor": ["./lib/ngx-umeditor.module"], 16 | "ngx-umeditor/*": ["./lib/*"] 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": ["node_modules/codelyzer"], 3 | "rules": { 4 | "callable-types": true, 5 | "class-name": true, 6 | "comment-format": [true, "check-space"], 7 | "curly": false, 8 | "eofline": true, 9 | "forin": true, 10 | "import-blacklist": [true], 11 | "import-spacing": true, 12 | "indent": [true, "spaces"], 13 | "interface-over-type-literal": true, 14 | "label-position": true, 15 | "max-line-length": [false, 140], 16 | "member-access": false, 17 | "member-ordering": [false], 18 | "no-arg": true, 19 | "no-bitwise": true, 20 | "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], 21 | "no-construct": true, 22 | "no-debugger": true, 23 | "no-duplicate-variable": true, 24 | "no-empty": false, 25 | "no-empty-interface": true, 26 | "no-eval": true, 27 | "no-inferrable-types": [true, "ignore-params"], 28 | "no-shadowed-variable": true, 29 | "no-string-literal": false, 30 | "no-string-throw": true, 31 | "no-switch-case-fall-through": true, 32 | "no-trailing-whitespace": true, 33 | "no-unused-expression": true, 34 | "no-use-before-declare": true, 35 | "no-var-keyword": true, 36 | "object-literal-sort-keys": false, 37 | "one-line": [ 38 | false, 39 | "check-open-brace", 40 | "check-catch", 41 | "check-else", 42 | "check-whitespace" 43 | ], 44 | "prefer-const": true, 45 | "quotemark": [true, "single"], 46 | "radix": true, 47 | "semicolon": [true, "always"], 48 | "triple-equals": [true, "allow-null-check"], 49 | "typedef-whitespace": [ 50 | true, 51 | { 52 | "call-signature": "nospace", 53 | "index-signature": "nospace", 54 | "parameter": "nospace", 55 | "property-declaration": "nospace", 56 | "variable-declaration": "nospace" 57 | } 58 | ], 59 | "typeof-compare": true, 60 | "unified-signatures": true, 61 | "variable-name": false, 62 | "whitespace": [ 63 | true, 64 | "check-branch", 65 | "check-decl", 66 | "check-operator", 67 | "check-separator", 68 | "check-type" 69 | ], 70 | 71 | "directive-selector": [false, "attribute", "app", "camelCase"], 72 | "component-selector": [false, "element", "app", "kebab-case"], 73 | "use-input-property-decorator": true, 74 | "use-output-property-decorator": true, 75 | "use-host-property-decorator": true, 76 | "no-input-rename": true, 77 | "no-output-rename": true, 78 | "use-life-cycle-interface": true, 79 | "use-pipe-transform-interface": true, 80 | "component-class-suffix": true, 81 | "directive-class-suffix": true, 82 | "no-access-missing-member": true, 83 | "templates-use-public": true, 84 | "invoke-injectable": true 85 | }, 86 | "linterOptions": { 87 | "exclude": [ 88 | "lib/**/*.spec.ts" 89 | ] 90 | } 91 | } 92 | --------------------------------------------------------------------------------