Commit b7854a53 authored by john's avatar john

2949

parent 6fc3bf44
<?php
namespace backend\assets;
use yii\web\AssetBundle;
class DocumentationAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'plugins/editormd/css/editormd.css',
];
public $js = [
'plugins/editormd/editormd.js',
'plugins/editormd/documentation.js',
];
public $depends = [
'yii\web\JqueryAsset',
];
}
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/params-local.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/params-local.php')
);
return [
......@@ -11,52 +9,53 @@ return [
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'language' => 'ru-RU',
'defaultRoute' => '/main/main-admin/index',
'language' => 'ru-RU',
'defaultRoute' => '/main/main-admin/index',
'modules' => [
'languages' => ['class' => 'common\modules\languages\Module'],
'content' => ['class' => 'common\modules\content\Module'],
'languages' => ['class' => 'common\modules\languages\Module'],
'content' => ['class' => 'common\modules\content\Module'],
'cases' => ['class' => 'common\modules\cases\Module'],
'bids' => ['class' => 'common\modules\bids\Module'],
'faq' => ['class' => 'common\modules\faq\Module'],
'blog' => ['class' => 'common\modules\blog\Module'],
'sessions' => ['class' => 'common\modules\sessions\Module'],
'reviews' => ['class' => 'common\modules\reviews\Module'],
'users' => ['class' => 'common\modules\users\users'],
'testings' => ['class' => 'common\modules\testings\Module'],
'main' => ['class' => 'common\modules\main\main'],
'utility' => ['class' => 'c006\utility\migration\Module'],
'faq' => ['class' => 'common\modules\faq\Module'],
'documentation' => ['class' => 'common\modules\documentation\Module'],
'blog' => ['class' => 'common\modules\blog\Module'],
'sessions' => ['class' => 'common\modules\sessions\Module'],
'reviews' => ['class' => 'common\modules\reviews\Module'],
'users' => ['class' => 'common\modules\users\users'],
'testings' => ['class' => 'common\modules\testings\Module'],
'main' => ['class' => 'common\modules\main\main'],
'utility' => ['class' => 'c006\utility\migration\Module'],
'triggers' => ['class' => 'common\modules\triggers\Module'],
'message-template' => ['class' => 'common\modules\messageTemplate\Module'],
'school' => ['class' => 'common\modules\school\Module'],
'support' => ['class' => 'common\modules\support\Module'],
'rbac' => ['class' => 'common\modules\rbac\rbac'],
'unisender' => ['class' => 'common\modules\unisender\Module'],
'analyticsSchool' => ['class' => 'common\modules\analyticsSchool\Module',],
],
'analyticsSchool' => ['class' => 'common\modules\analyticsSchool\Module',]
],
'components' => [
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
],
'session' => [
'class' => 'yii\web\Session',
],
'dater' => [
'class' => '\common\components\DaterComponent',
],
'formatter' => [
'class' => 'yii\i18n\Formatter',
'locale' => 'ru-RU',
'timeZone' => 'Europe/Moscow',
],
'i18n' => [
'translations' => [
'*' => [
'class' => 'yii\i18n\PhpMessageSource'
],
],
],
'session' => [
'class' => 'yii\web\Session',
],
'dater' => [
'class' => '\common\components\DaterComponent',
],
'formatter' => [
'class' => 'yii\i18n\Formatter',
'locale' => 'ru-RU',
'timeZone' => 'Europe/Moscow',
],
'i18n' => [
'translations' => [
'*' => [
'class' => 'yii\i18n\PhpMessageSource'
],
],
],
'user' => [
'identityClass' => 'common\modules\users\models\User',
'identityCookie' => [
......@@ -76,48 +75,48 @@ return [
'errorHandler' => [
'errorAction' => 'site/error',
],
'assetManager'=>[
'linkAssets' => true,
'assetManager' => [
'linkAssets' => true,
'bundles' => [
'xj\tagit\TagitAsset' => [
'js' => [],
'css' => []
],
'yii\bootstrap\BootstrapPluginAsset' => [
'js' => [
],
],
'yii\web\JqueryAsset' => [
'xj\tagit\TagitAsset' => [
'js' => [],
'css' => []
],
'yii\bootstrap\BootstrapPluginAsset' => [
'js' => [
],
],
'yii\web\JqueryAsset' => [
'sourcePath' => null,
'js' => [
'plugins/jquery/jquery-1.9.1.min.js',
'plugins/jquery/jquery-1.9.1.min.js',
],
'jsOptions' => [
'position' => \yii\web\View::POS_HEAD,
],
'jsOptions' => [
'position' => \yii\web\View::POS_HEAD,
],
],
'yii\jui\JuiAsset' => [
'yii\jui\JuiAsset' => [
'sourcePath' => null,
'js' => [
'plugins/jquery-ui/ui/minified/jquery-ui.min.js',
'plugins/jquery-ui/ui/minified/jquery.ui.widget.min.js',
'plugins/jquery-ui/ui/minified/jquery-ui.min.js',
'plugins/jquery-ui/ui/minified/jquery.ui.widget.min.js',
],
'jsOptions' => [
'position' => \yii\web\View::POS_HEAD,
],
'jsOptions' => [
'position' => \yii\web\View::POS_HEAD,
],
'css' => [],
'css' => [],
],
'yii\bootstrap\BootstrapAsset' => [
'css' => [],
]
'yii\bootstrap\BootstrapAsset' => [
'css' => [],
]
]
],
'authManager' => [
'authManager' => [
'class' => 'yii\rbac\DbManager',
/*'connectionID' => 'db',
'itemTable' => 'auth_items',
'assignmentTable' => 'auth_assignments',
'itemChildTable' => 'auth_item_child',*/
/* 'connectionID' => 'db',
'itemTable' => 'auth_items',
'assignmentTable' => 'auth_assignments',
'itemChildTable' => 'auth_item_child', */
'defaultRoles' => [
'user',
'moderator',
......@@ -125,25 +124,22 @@ return [
'superadmin'
],
],
'urlManager' => [
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'enableStrictParsing' => true,
'rules' => [
'<module_id>/settings/manage' => 'settings/manage',
'<module_id>/settings/create' => 'settings/create',
'<module_id>/settings/update/<id>' => 'settings/update',
'<module_id>/settings/delete/<id>' => 'settings/delete',
'<module_id>/settings/view/<id>' => 'settings/view',
'/' => 'site/index',
'' => 'site/index',
'users/user-admin/manage/is_deleted/<is_deleted>' => 'users/user-admin/manage',
'<_m>/<_c>/<_a>/<id>' => '<_m>/<_c>/<_a>',
'<_m>/<_c>/<_a>' => '<_m>/<_c>/<_a>',
'<_c>/<_a>' => '<_c>/<_a>',
'<module_id>/settings/manage' => 'settings/manage',
'<module_id>/settings/create' => 'settings/create',
'<module_id>/settings/update/<id>' => 'settings/update',
'<module_id>/settings/delete/<id>' => 'settings/delete',
'<module_id>/settings/view/<id>' => 'settings/view',
'/' => 'site/index',
'' => 'site/index',
'users/user-admin/manage/is_deleted/<is_deleted>' => 'users/user-admin/manage',
'<_m>/<_c>/<_a>/<id>' => '<_m>/<_c>/<_a>',
'<_m>/<_c>/<_a>' => '<_m>/<_c>/<_a>',
'<_c>/<_a>' => '<_c>/<_a>',
]
],
'formatter' => [
......
......@@ -129,4 +129,29 @@ a.desc:after {
}
.file-preview-image {
height: 100px !important;
}
.list_list_id .row{
margin: 0 0;
}
.list_list_id .row>[class*=col-] {
padding: 0 0;
}
.list_parent_id .row{
margin: 0 0;
}
.list_parent_id .row>[class*=col-] {
padding: 0 0;
}
.tree-view-wrapper .tree-heading-container {
margin: 4px 6px 4px 0;
}
.co-documentation-form .tab-pane.fade{
display: block;
height: 1px;
overflow: hidden
}
.co-documentation-form .tab-pane.fade.in{
display: block;
height: auto;
overflow: auto
}
\ No newline at end of file
$(function() {
$(function ()
{
$('.datepicker-autoClose').datepicker({
dateFormat: 'dd.mm.yy',
todayHighlight: true,
......@@ -16,9 +17,10 @@ $(function() {
});
FormSliderSwitcher.init();
$('.no_editor_wrapper textarea').addClass('no_editor')
tinymce.init({
selector: "textarea",
selector: "textarea:not('.no_editor')",
theme: "modern",
language: "ru",
schema: "html5",
......
logs
*.log
*.pid
*.seed
node_modules/
.sass-cache/
research/
test/
backup/
examples/uploads/**/*
*.bat
*.sh
.project
.url
css/*.map
\ No newline at end of file
{
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "double",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"white": true
}
\ No newline at end of file
#Bugs
> 说明:删除线表示已经解决。
####IE8
- ~~不能加载;~~
- flowChart(流程图)、sequenceDiagram(序列图)不支持IE8;
- ~~不支持Markdown转HTML页面解析预览;~~
####IE8 & IE9 & IE10
- KaTeX会出现解析错误,但不影响程序运行;
####Sea.js
- ~~Raphael.js无法加载;~~
####Require.js
- ~~CodeMirror编辑器的代码无法高亮;~~
- ~~sequenceDiagram不支持: `Uncaught TypeError: Cannot call method 'isArray' of undefined.`~~
This diff is collapsed.
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2015 pandao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Editor.md
![](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)
![](https://img.shields.io/github/stars/pandao/editor.md.svg)
![](https://img.shields.io/github/forks/pandao/editor.md.svg)
![](https://img.shields.io/github/tag/pandao/editor.md.svg)
![](https://img.shields.io/github/release/pandao/editor.md.svg)
![](https://img.shields.io/github/issues/pandao/editor.md.svg)
![](https://img.shields.io/bower/v/editor.md.svg)
**Editor.md** : The open source embeddable online markdown editor (component), based on CodeMirror & jQuery & Marked.
### Features
- Support Standard Markdown / CommonMark and GFM (GitHub Flavored Markdown);
- Full-featured: Real-time Preview, Image (cross-domain) upload, Preformatted text/Code blocks/Tables insert, Code fold, Search replace, Read only, Themes, Multi-languages, L18n, HTML entities, Code syntax highlighting...;
- Markdown Extras : Support [ToC (Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html), [Emoji](https://pandao.github.io/editor.md/examples/emoji.html), [Task lists](https://pandao.github.io/editor.md/examples/task-lists.html), [@Links](https://pandao.github.io/editor.md/examples/@links.html)...;
- Compatible with all major browsers (IE8+), compatible Zepto.js and iPad;
- Support [decode & fliter of the HTML tags & attributes](https://pandao.github.io/editor.md/examples/html-tags-decode.html);
- Support [TeX (LaTeX expressions, Based on KaTeX)](https://pandao.github.io/editor.md/examples/katex.html), [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html) and [Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html) of Markdown extended syntax;
- Support AMD/CMD (Require.js & Sea.js) Module Loader, and Custom/define editor plugins;
[README & Examples (English)](https://pandao.github.io/editor.md/en.html)
--------
**Editor.md** 是一款开源的、可嵌入的 Markdown 在线编辑器(组件),基于 CodeMirror、jQuery 和 Marked 构建。
![editormd-screenshot](https://pandao.github.io/editor.md/examples/images/editormd-screenshot.png "editormd-screenshot")
#### 主要特性
- 支持通用 Markdown / CommonMark 和 GFM (GitHub Flavored Markdown) 风格的语法,也可[变身为代码编辑器](https://pandao.github.io/editor.md/examples/change-mode.html)
- 支持实时预览、图片(跨域)上传、预格式文本/代码/表格插入、代码折叠、跳转到行、搜索替换、只读模式、自定义样式主题和多语言语法高亮等功能;
- 支持 [ToC(Table of Contents)](https://pandao.github.io/editor.md/examples/toc.html)[Emoji表情](https://pandao.github.io/editor.md/examples/emoji.html)[Task lists](https://pandao.github.io/editor.md/examples/task-lists.html)[@链接](https://pandao.github.io/editor.md/examples/@links.html)等 Markdown 扩展语法;
- 支持 TeX 科学公式(基于 [KaTeX](https://pandao.github.io/editor.md/examples/katex.html))、流程图 [Flowchart](https://pandao.github.io/editor.md/examples/flowchart.html)[时序图 Sequence Diagram](https://pandao.github.io/editor.md/examples/sequence-diagram.html);
- 支持[识别和解析 HTML 标签,并且支持自定义过滤标签及属性解析](https://pandao.github.io/editor.md/examples/html-tags-decode.html),具有可靠的安全性和几乎无限的扩展性;
- 支持 AMD / CMD 模块化加载(支持 [Require.js](https://pandao.github.io/editor.md/examples/use-requirejs.html) & [Sea.js](https://pandao.github.io/editor.md/examples/use-seajs.html)),并且支持[自定义扩展插件](https://pandao.github.io/editor.md/examples/define-plugin.html)
- 兼容主流的浏览器(IE8+)和 [Zepto.js](https://pandao.github.io/editor.md/examples/use-zepto.html),且支持 iPad 等平板设备;
#### Examples
[https://pandao.github.io/editor.md/examples/index.html](https://pandao.github.io/editor.md/examples/index.html)
#### Download & install
[Github download](https://github.com/pandao/editor.md/archive/master.zip)
Bower install :
```shell
bower install editor.md
```
#### Usages
HTML:
```html
<link rel="stylesheet" href="editormd.min.css" />
<div id="editormd">
<textarea style="display:none;">### Hello Editor.md !</textarea>
</div>
```
> Tip: Editor.md can auto append `<textarea>` tag;
javascript:
```html
<script src="jquery.min.js"></script>
<script src="editormd.min.js"></script>
<script type="text/javascript">
$(function() {
var editor = editormd("editormd", {
path : "../lib/" // Autoload modules mode, codemirror, marked... dependents libs path
});
/*
// or
var editor = editormd({
id : "editormd",
path : "../lib/"
});
*/
});
</script>
```
Using modular script loader :
- [Using Require.js](https://github.com/pandao/editor.md/tree/master/examples/use-requirejs.html)
- [Using Sea.js](https://github.com/pandao/editor.md/tree/master/examples/use-seajs.html)
#### Dependents
- [CodeMirror](http://codemirror.net/ "CodeMirror")
- [marked](https://github.com/chjj/marked "marked")
- [jQuery](http://jquery.com/ "jQuery")
- [FontAwesome](http://fontawesome.io/ "FontAwesome")
- [github-markdown.css](https://github.com/sindresorhus/github-markdown-css "github-markdown.css")
- [KaTeX](http://khan.github.io/KaTeX/ "KaTeX")
- [prettify.js](http://code.google.com/p/google-code-prettify/ "prettify.js")
- [Rephael.js](http://raphaeljs.com/ "Rephael.js")
- [flowchart.js](http://adrai.github.io/flowchart.js/ "flowchart.js")
- [sequence-diagram.js](http://bramp.github.io/js-sequence-diagrams/ "sequence-diagram.js")
- [Prefixes.scss](https://github.com/pandao/prefixes.scss "Prefixes.scss")
#### Changes
[Change logs](https://github.com/pandao/editor.md/blob/master/CHANGE.md)
#### License
The MIT License.
Copyright (c) 2015 Pandao
{
"name": "editor.md",
"version": "1.5.0",
"homepage": "https://github.com/pandao/editor.md",
"authors": [
"Pandao <pandao@vip.qq.com>"
],
"description": "Open source online markdown editor.",
"keywords": [
"editor.md",
"markdown",
"editor"
],
"license": "MIT",
"ignore": [
"**/.*",
"research",
"docs",
"node_modules",
"bower_components",
"test",
"tests"
]
}
This diff is collapsed.
/*
* Editor.md
*
* @file editormd.logo.css
* @version v1.5.0
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2015-06-09
*/
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */
@font-face {
font-family: 'editormd-logo';
src: url("../fonts/editormd-logo.eot?-5y8q6h");
src: url(".../fonts/editormd-logo.eot?#iefix-5y8q6h") format("embedded-opentype"), url("../fonts/editormd-logo.woff?-5y8q6h") format("woff"), url("../fonts/editormd-logo.ttf?-5y8q6h") format("truetype"), url("../fonts/editormd-logo.svg?-5y8q6h#icomoon") format("svg");
font-weight: normal;
font-style: normal;
}
.editormd-logo,
.editormd-logo-1x,
.editormd-logo-2x,
.editormd-logo-3x,
.editormd-logo-4x,
.editormd-logo-5x,
.editormd-logo-6x,
.editormd-logo-7x,
.editormd-logo-8x {
font-family: 'editormd-logo';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
font-size: inherit;
line-height: 1;
display: inline-block;
text-rendering: auto;
vertical-align: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.editormd-logo:before,
.editormd-logo-1x:before,
.editormd-logo-2x:before,
.editormd-logo-3x:before,
.editormd-logo-4x:before,
.editormd-logo-5x:before,
.editormd-logo-6x:before,
.editormd-logo-7x:before,
.editormd-logo-8x:before {
content: "\e1987";
/*
HTML Entity &#xe1987;
example: <span class="editormd-logo">&#xe1987;</span>
*/
}
.editormd-logo-1x {
font-size: 1em;
}
.editormd-logo-lg {
font-size: 1.2em;
}
.editormd-logo-2x {
font-size: 2em;
}
.editormd-logo-3x {
font-size: 3em;
}
.editormd-logo-4x {
font-size: 4em;
}
.editormd-logo-5x {
font-size: 5em;
}
.editormd-logo-6x {
font-size: 6em;
}
.editormd-logo-7x {
font-size: 7em;
}
.editormd-logo-8x {
font-size: 8em;
}
.editormd-logo-color {
color: #2196F3;
}
/*! Editor.md v1.5.0 | editormd.logo.min.css | Open source online markdown editor. | MIT License | By: Pandao | https://github.com/pandao/editor.md | 2015-06-09 */
/*! prefixes.scss v0.1.0 | Author: Pandao | https://github.com/pandao/prefixes.scss | MIT license | Copyright (c) 2015 */@font-face{font-family:editormd-logo;src:url(../fonts/editormd-logo.eot?-5y8q6h);src:url(.../fonts/editormd-logo.eot?#iefix-5y8q6h)format("embedded-opentype"),url(../fonts/editormd-logo.woff?-5y8q6h)format("woff"),url(../fonts/editormd-logo.ttf?-5y8q6h)format("truetype"),url(../fonts/editormd-logo.svg?-5y8q6h#icomoon)format("svg");font-weight:400;font-style:normal}.editormd-logo,.editormd-logo-1x,.editormd-logo-2x,.editormd-logo-3x,.editormd-logo-4x,.editormd-logo-5x,.editormd-logo-6x,.editormd-logo-7x,.editormd-logo-8x{font-family:editormd-logo;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;font-size:inherit;line-height:1;display:inline-block;text-rendering:auto;vertical-align:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.editormd-logo-1x:before,.editormd-logo-2x:before,.editormd-logo-3x:before,.editormd-logo-4x:before,.editormd-logo-5x:before,.editormd-logo-6x:before,.editormd-logo-7x:before,.editormd-logo-8x:before,.editormd-logo:before{content:"\e1987"}.editormd-logo-1x{font-size:1em}.editormd-logo-lg{font-size:1.2em}.editormd-logo-2x{font-size:2em}.editormd-logo-3x{font-size:3em}.editormd-logo-4x{font-size:4em}.editormd-logo-5x{font-size:5em}.editormd-logo-6x{font-size:6em}.editormd-logo-7x{font-size:7em}.editormd-logo-8x{font-size:8em}.editormd-logo-color{color:#2196F3}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Home</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Home</h1>
<h3> </h3>
</div>
<nav>
<h2><a href="index.html">Home</a></h2>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0</a> on Mon Jun 08 2015 01:07:40 GMT+0800 (中国标准时间)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
\ No newline at end of file
/*global document */
(function() {
var source = document.getElementsByClassName('prettyprint source linenums');
var i = 0;
var lineNumber = 0;
var lineId;
var lines;
var totalLines;
var anchorHash;
if (source && source[0]) {
anchorHash = document.location.hash.substring(1);
lines = source[0].getElementsByTagName('li');
totalLines = lines.length;
for (; i < totalLines; i++) {
lineNumber++;
lineId = 'line' + lineNumber;
lines[i].id = lineId;
if (lineId === anchorHash) {
lines[i].className += ' selected';
}
}
}
})();
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com",
/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);
This diff is collapsed.
@font-face {
font-family: 'Open Sans';
font-weight: normal;
font-style: normal;
src: url('../fonts/OpenSans-Regular-webfont.eot');
src:
local('Open Sans'),
local('OpenSans'),
url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
}
@font-face {
font-family: 'Open Sans Light';
font-weight: normal;
font-style: normal;
src: url('../fonts/OpenSans-Light-webfont.eot');
src:
local('Open Sans Light'),
local('OpenSans Light'),
url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/OpenSans-Light-webfont.woff') format('woff'),
url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg');
}
html
{
overflow: auto;
background-color: #fff;
font-size: 14px;
}
body
{
font-family: 'Open Sans', sans-serif;
line-height: 1.5;
color: #4d4e53;
background-color: white;
}
a, a:visited, a:active {
color: #0095dd;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
header
{
display: block;
padding: 0px 4px;
}
tt, code, kbd, samp {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
.class-description {
font-size: 130%;
line-height: 140%;
margin-bottom: 1em;
margin-top: 1em;
}
.class-description:empty {
margin: 0;
}
#main {
float: left;
width: 70%;
}
article dl {
margin-bottom: 40px;
}
section
{
display: block;
background-color: #fff;
padding: 12px 24px;
border-bottom: 1px solid #ccc;
margin-right: 30px;
}
.variation {
display: none;
}
.signature-attributes {
font-size: 60%;
color: #aaa;
font-style: italic;
font-weight: lighter;
}
nav
{
display: block;
float: right;
margin-top: 28px;
width: 30%;
box-sizing: border-box;
border-left: 1px solid #ccc;
padding-left: 16px;
}
nav ul {
font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif;
font-size: 100%;
line-height: 17px;
padding: 0;
margin: 0;
list-style-type: none;
}
nav ul a, nav ul a:visited, nav ul a:active {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
line-height: 18px;
color: #4D4E53;
}
nav h3 {
margin-top: 12px;
}
nav li {
margin-top: 6px;
}
footer {
display: block;
padding: 6px;
margin-top: 12px;
font-style: italic;
font-size: 90%;
}
h1, h2, h3, h4 {
font-weight: 200;
margin: 0;
}
h1
{
font-family: 'Open Sans Light', sans-serif;
font-size: 48px;
letter-spacing: -2px;
margin: 12px 24px 20px;
}
h2, h3
{
font-size: 30px;
font-weight: 700;
letter-spacing: -1px;
margin-bottom: 12px;
}
h4
{
font-size: 18px;
letter-spacing: -0.33px;
margin-bottom: 12px;
color: #4d4e53;
}
h5, .container-overview .subsection-title
{
font-size: 120%;
font-weight: bold;
letter-spacing: -0.01em;
margin: 8px 0 3px 0;
}
h6
{
font-size: 100%;
letter-spacing: -0.01em;
margin: 6px 0 3px 0;
font-style: italic;
}
.ancestors { color: #999; }
.ancestors a
{
color: #999 !important;
text-decoration: none;
}
.clear
{
clear: both;
}
.important
{
font-weight: bold;
color: #950B02;
}
.yes-def {
text-indent: -1000px;
}
.type-signature {
color: #aaa;
}
.name, .signature {
font-family: Consolas, Monaco, 'Andale Mono', monospace;
}
.details { margin-top: 14px; border-left: 2px solid #DDD; }
.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; }
.details dd { margin-left: 70px; }
.details ul { margin: 0; }
.details ul { list-style-type: none; }
.details li { margin-left: 30px; padding-top: 6px; }
.details pre.prettyprint { margin: 0 }
.details .object-value { padding-top: 0; }
.description {
margin-bottom: 1em;
margin-top: 1em;
}
.code-caption
{
font-style: italic;
font-size: 107%;
margin: 0;
}
.prettyprint
{
border: 1px solid #ddd;
width: 80%;
overflow: auto;
}
.prettyprint.source {
width: inherit;
}
.prettyprint code
{
font-size: 100%;
line-height: 18px;
display: block;
padding: 4px 12px;
margin: 0;
background-color: #fff;
color: #4D4E53;
}
.prettyprint code span.line
{
display: inline-block;
}
.prettyprint.linenums
{
padding-left: 70px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.prettyprint.linenums ol
{
padding-left: 0;
}
.prettyprint.linenums li
{
border-left: 3px #ddd solid;
}
.prettyprint.linenums li.selected,
.prettyprint.linenums li.selected *
{
background-color: lightyellow;
}
.prettyprint.linenums li *
{
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
.params, .props
{
border-spacing: 0;
border: 0;
border-collapse: collapse;
}
.params .name, .props .name, .name code {
color: #4D4E53;
font-family: Consolas, Monaco, 'Andale Mono', monospace;
font-size: 100%;
}
.params td, .params th, .props td, .props th
{
border: 1px solid #ddd;
margin: 0px;
text-align: left;
vertical-align: top;
padding: 4px 6px;
display: table-cell;
}
.params thead tr, .props thead tr
{
background-color: #ddd;
font-weight: bold;
}
.params .params thead tr, .props .props thead tr
{
background-color: #fff;
font-weight: bold;
}
.params th, .props th { border-right: 1px solid #aaa; }
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
.params td.description > p:first-child,
.props td.description > p:first-child
{
margin-top: 0;
padding-top: 0;
}
.params td.description > p:last-child,
.props td.description > p:last-child
{
margin-bottom: 0;
padding-bottom: 0;
}
.disabled {
color: #454545;
}
/* JSDoc prettify.js theme */
/* plain text */
.pln {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* string content */
.str {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a keyword */
.kwd {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a comment */
.com {
font-weight: normal;
font-style: italic;
}
/* a type name */
.typ {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a literal value */
.lit {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* punctuation */
.pun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp open bracket */
.opn {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* lisp close bracket */
.clo {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a markup tag name */
.tag {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute name */
.atn {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a markup attribute value */
.atv {
color: #006400;
font-weight: normal;
font-style: normal;
}
/* a declaration */
.dec {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* a variable name */
.var {
color: #000000;
font-weight: normal;
font-style: normal;
}
/* a function name */
.fun {
color: #000000;
font-weight: bold;
font-style: normal;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0;
}
/* Tomorrow Theme */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
/* plain text */
.pln {
color: #4d4d4c; }
@media screen {
/* string content */
.str {
color: #718c00; }
/* a keyword */
.kwd {
color: #8959a8; }
/* a comment */
.com {
color: #8e908c; }
/* a type name */
.typ {
color: #4271ae; }
/* a literal value */
.lit {
color: #f5871f; }
/* punctuation */
.pun {
color: #4d4d4c; }
/* lisp open bracket */
.opn {
color: #4d4d4c; }
/* lisp close bracket */
.clo {
color: #4d4d4c; }
/* a markup tag name */
.tag {
color: #c82829; }
/* a markup attribute name */
.atn {
color: #f5871f; }
/* a markup attribute value */
.atv {
color: #3e999f; }
/* a declaration */
.dec {
color: #f5871f; }
/* a variable name */
.var {
color: #c82829; }
/* a function name */
.fun {
color: #4271ae; } }
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str {
color: #060; }
.kwd {
color: #006;
font-weight: bold; }
.com {
color: #600;
font-style: italic; }
.typ {
color: #404;
font-weight: bold; }
.lit {
color: #044; }
.pun, .opn, .clo {
color: #440; }
.tag {
color: #006;
font-weight: bold; }
.atn {
color: #404; }
.atv {
color: #060; } }
/* Style */
/*
pre.prettyprint {
background: white;
font-family: Consolas, Monaco, 'Andale Mono', monospace;
font-size: 12px;
line-height: 1.5;
border: 1px solid #ccc;
padding: 10px; }
*/
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0; }
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L4,
li.L5,
li.L6,
li.L7,
li.L8,
li.L9 {
/* */ }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
/* */ }
var testEditor = {};
$(function ()
{
$('.documentation-editormd').each(function ()
{
var id = $(this).attr('id');
testEditor[id] = editormd(id, {
width: "100%",
height: 740,
path: '/plugins/editormd/lib/',
// theme: "dark",
// previewTheme: "dark",
// editorTheme: "pastel-on-dark",
markdown: $('.' + id + ' textarea').val(),
codeFold: true,
//syncScrolling : false,
saveHTMLToTextarea: true, // 保存 HTML 到 Textarea
searchReplace: true,
//watch : false, // 关闭实时预览
htmlDecode: "style,script,iframe|on*", // 开启 HTML 标签解析,为了安全性,默认不开启
//toolbar : false, //关闭工具栏
//previewCodeHighlight : false, // 关闭预览 HTML 的代码块高亮,默认开启
emoji: true,
taskList: true,
tocm: true, // Using [TOCM]
tex: true, // 开启科学公式TeX语言支持,默认关闭
flowChart: true, // 开启流程图支持,默认关闭
sequenceDiagram: true, // 开启时序/序列图支持,默认关闭,
//dialogLockScreen : false, // 设置弹出层对话框不锁屏,全局通用,默认为true
//dialogShowMask : false, // 设置弹出层对话框显示透明遮罩层,全局通用,默认为true
//dialogDraggable : false, // 设置弹出层对话框不可拖动,全局通用,默认为true
//dialogMaskOpacity : 0.4, // 设置透明遮罩层的透明度,全局通用,默认值为0.1
//dialogMaskBgColor : "#000", // 设置透明遮罩层的背景颜色,全局通用,默认为#fff
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL: "./php/upload.php",
onload: function ()
{
console.log('onload', this);
//this.fullscreen();
//this.unwatch();
//this.watch().fullscreen();
//this.setMarkdown("#PHP");
//this.width("100%");
//this.height(480);
//this.resize("100%", 640);
}
});
})
$("#documentation-form").on("submit", function ()
{
$('.documentation-editormd').each(function ()
{
var data_id = $(this).attr('data-id');
var id = $(this).attr('id');
$('#doccontentlang-' + data_id + '-markdown').val(testEditor[id].getMarkdown())
$('#doccontentlang-' + data_id + '-html').val(testEditor[id].getHTML())
})
});
// $("#goto-line-btn").bind("click", function ()
// {
// testEditor.gotoLine(90);
// });
//
// $("#show-btn").bind('click', function ()
// {
// testEditor.show();
// });
//
// $("#hide-btn").bind('click', function ()
// {
// testEditor.hide();
// });
//
// $("#get-md-btn").bind('click', function ()
// {
// alert(testEditor.getMarkdown());
// });
//
// $("#get-html-btn").bind('click', function ()
// {
// alert(testEditor.getHTML());
// });
//
// $("#watch-btn").bind('click', function ()
// {
// testEditor.watch();
// });
//
// $("#unwatch-btn").bind('click', function ()
// {
// testEditor.unwatch();
// });
//
// $("#preview-btn").bind('click', function ()
// {
// testEditor.previewing();
// });
//
// $("#fullscreen-btn").bind('click', function ()
// {
// testEditor.fullscreen();
// });
//
// $("#show-toolbar-btn").bind('click', function ()
// {
// testEditor.showToolbar();
// });
//
// $("#close-toolbar-btn").bind('click', function ()
// {
// testEditor.hideToolbar();
// });
//
// $("#toc-menu-btn").click(function ()
// {
// testEditor.config({
// tocDropdown: true,
// tocTitle: "目录 Table of Contents",
// });
// });
//
// $("#toc-default-btn").click(function ()
// {
// testEditor.config("tocDropdown", false);
// });
});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>@links - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>@links</h1>
<p>Github Flavored Markdown extras syntax</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Disable @link & email address auto link
> Editor.md default enable @link & email address auto link;
> Unsupported xxxx@xxxxx, xxxx@localhost ...
```javascript
var testEditor;
$(function() {
// You can custom @link base url.
editormd.urls.atLinkBase = "https://github.com/";
testEditor = editormd("test-editormd", {
atLink : false, // disable @link
emailLink : false, // disable email address auto link
path : '../lib/'
});
});
```
### @links
[TOC]
~~@mentions~~, #refs @tylerlong `inline code @tylerlong`, [links](), **formatting**, and <del>tags</del> supported @pandao;
list syntax required (any unordered or ordered list supported) @pandao;
this is @pandao a complete item @pandao xxx.test@gmail.com;
link [@pandao](https://github.com/pandao "@pandao") &#64 xxx.test@gmail.com;
link [&#64;pandao](https://github.com/pandao "&#64;pandao")
fsdafds [Gmail](mailto:xxx.test@gmail.com) this is an incomplete item **@pandao**;
*@pandao* this is an incomplete item ___@pandao___;
<xxx.test@gmail.com>
<mailto:xxx.test@gmail.com>
Email test : [email me](mailto:test@test.com) [Gmail](mailto:xxx.test@gmail.com) dsfdfsdfsdfsdf xxx.test@gmail.com fdfsdfsdf 5956565656565@vip.qq.com
# Github: @pandao
## Github: @pandao
### Github: @tylerlong
#### Github: @tylerlong
##### Github: @tylerlong
###### Github: @tylerlong [Gmail](mailto:xxx.test@gmail.com)
- dafssdfsdaf@chjj dfsdfsdf [5956565656565@vip.qq.com](mailto:5956565656565@vip.qq.com)
- dafssdfsdaf@chjj dfsdfsdf
- dafssdfsdaf@chjj dfsdfsdf
- dafss@pandao dfsdaf@chjj dfsdfsdf
- dafssd: @pandao fsdaf@chjj dfsdfsdf @codemirror @pandao
+ dafssdfsdaf@chjj dfsdfsdf
+ dafss@pandaodfsdaf@chjj dfsdfsdf
1. @chjj 第一行@pandao fsdaf@chjj dfsdfsdf :fa-save:: @pandao
- dafssdfsdaf@chjj dfsdfsdf
- dafss@pandao dfsdaf@chjj dfsdfsdf
2. @chjj 第二行@pandao fsdaf@chjj dfsdfsdf @codemirror @pandao
3. 第三行@pandao fsdaf@chjj dfsdfsdf :fa-save:: @pandao
&gt; Blockquotes @pandao
&gt; dd@pandao引用文本(Blockquotes @pandao)fdasfad @_pandao fdasfad @xxx454xxx fdasfad @xx_x454xxx454
|@pandao First Header | Second@pandao Header@pandao |
| ------------- | ------------- |
| Content@pandao Cell | @pandao Content Cell @pandao|
| Con@pandao tent Cell@pandao | Content@pan-dao Cell dfsdfsdf @pan_dao |
dsfdf@pandao fasdfsdfsfddffd@pandao
dfasfasdfasdf:bangbang:
This is an H1 @pandao
=============
This @pandao an H2 @pandao
-------------
http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png
http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png
http://socialpro.demo.ipandao.com/app/images/welcom-logo@4x.png
[![http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png)](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png)
[http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png)
[http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@3x.png)
![http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png](http://socialpro.demo.ipandao.com/app/images/welcom-logo@2x.png)
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
// You can custom @link base url.
editormd.urls.atLinkBase = "https://github.com/";
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
toc : true,
//atLink : false, // disable @link
//emailLink : false, // disable email address auto link
todoList : true,
path : '../lib/'
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Auto height - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Auto height test</h1>
</header>
<div class="btns">
<button id="append-btn">Append markdown</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">### Settings
```javascript
var testEditor = editormd("test-editormd", {
autoHeight : true
});
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width : "90%",
autoHeight : true,
path : "../lib/",
htmlDecode : "style,script,iframe",
tex : true,
emoji : true,
taskList : true,
flowChart : true,
sequenceDiagram : true
});
$("#append-btn").click(function(){
$.get("./test.md", function(md){
testEditor.appendMarkdown(md);
});
});
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Code folding - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Code folding</h1>
<p>Switch code folding : Press Ctrl + Q / Command + Q</p>
</header>
<div id="test-editormd">
<textarea style="display:none;"></textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
$.get("./test.md", function(md) {
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
markdown : "#### Setting\r\n\r\n {\n codeFold : true\n }\r\n\r\n" + md,
codeFold : true,
htmlDecode : true,
tex : true,
taskList : true,
emoji : true,
flowChart : true,
sequenceDiagram : true,
path : '../lib/'
});
});
});
</script>
</body>
</html>
\ No newline at end of file
* {
padding: 0;
margin: 0;
}
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{
margin: 0;
padding: 0;
}
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block;
}
audio, canvas, video {
display: inline-block;
}
img {
border: none;
vertical-align: middle;
}
ul, ol {
/*list-style: none;*/
}
.clear {
*zoom: 1; /* for IE 6/7 */
}
.clear:before, .clear:after {
height: 0;
content: "";
font-size: 0;
display: table;
line-height: 0; /* for Opera */
visibility: hidden;
}
.clear:after {
clear: both;
}
body {
font-size: 14px;
color: #666;
font-family: "Microsoft YaHei", "微软雅黑", Helvetica, Tahoma, STXihei, "华文细黑", STHeiti, "Helvetica Neue", Helvetica, Tahoma, "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "宋体", Heiti, "黑体", sans-serif;
background: #fff;
text-align: center;
}
#layout {
text-align: left;
}
#layout > header, .btns {
padding: 15px 0;
width: 90%;
margin: 0 auto;
}
.btns {
padding-top: 0;
}
.btns button {
padding: 2px 8px;
}
#layout > header > h1 {
font-size: 20px;
margin-bottom: 10px;
}
.btns button, .btn {
padding: 8px 10px;
background: #fff;
border: 1px solid #ddd;
-webkit-border-radius: 3px;
border-radius: 3px;
cursor: pointer;
-webkit-transition: background 300ms ease-out;
transition: background 300ms ease-out;
}
.btns button:hover, .btn:hover {
background: #f6f6f6;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Custom keyboard shortcuts - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Custom keyboard shortcuts</h1>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Default
> If Editor.md code editor is on focus, you can use keyboard shortcuts.
> Editor.md have the default keyboard shortcuts handle. Plaese open the help dialog, can see all default keyboard shortcuts.
#### Example
```javascript
var testEditor = editormd("test-editormd", {
width: "90%",
height: 720,
path : '../lib/',
disabledKeyMaps : [
"Ctrl-B", "F11", "F10" // disable some default keyboard shortcuts handle
],
onload : function() {
var keyMap = {
"Ctrl-S": function(cm) {
alert("Ctrl+S");
},
"Ctrl-A": function(cm) { // default Ctrl-A selectAll
// custom
alert("Ctrl+A");
cm.execCommand("selectAll");
}
};
// setting signle key
var keyMap2 = {
"Ctrl-T": function(cm) {
alert("Ctrl+T");
}
};
this.addKeyMap(keyMap);
this.addKeyMap(keyMap2);
this.removeKeyMap(keyMap2); // remove signle key
}
});
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
var widgets = [];
testEditor = editormd("test-editormd", {
width: "90%",
height: 720,
path : '../lib/',
disabledKeyMaps : [
"Ctrl-B", "F11", "F10" // disable some default keyboard shortcuts handle
],
onchange : function() {
$("#test").remove();
var cm = this.cm;
var cursor = cm.getCursor();
//cm.replaceSelection("@");
widgets.push(cm.addWidget({line : cursor.line, ch : cursor.ch}, $("<p style='z-index:100000;background:red;color:#fff;padding:5px;' id='test'>fsdfsdfsdf</p>")[0], true));
console.log(cm.getCursor(), cm.getLine(cursor.line), cm.getLineTokens(cursor.line));
},
onload : function() {
var keyMap = {
"Ctrl-S": function(cm) {
alert("Ctrl+S");
//return false;
},
"Ctrl-A": function(cm) { // default Ctrl-A selectAll
// custom
alert("Ctrl+A");
cm.execCommand("selectAll");
},
//"Shift-2" : function(cm){
//}
};
this.cm.on("keyup", function(cm){
//$("#test").remove();
});
// setting signle key
var keyMap2 = {
"Ctrl-T": function(cm) {
alert("Ctrl+T");
}
};
this.addKeyMap(keyMap);
this.addKeyMap(keyMap2);
this.removeKeyMap(keyMap2); // remove signle key
}
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>自定义工具栏 - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>自定义工具栏</h1>
<p>Custom toolbar (icons handler)</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Custom toolbar
```javascript
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
toolbarIcons : function() {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["undo", "redo", "|", "bold", "hr", "|", "preview", "watch", "|", "fullscreen", "info", "testIcon", "testIcon2", "file", "faicon", "||", "watch", "fullscreen", "preview", "testIcon"]
},
toolbarIconsClass : {
testIcon : "fa-gears" // 指定一个FontAawsome的图标类
},
toolbarIconTexts : {
testIcon2 : "测试按钮" // 如果没有图标,则可以这样直接插入内容,可以是字符串或HTML标签
},
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
toolbarCustomIcons : {
file : "&lt;input type="file" accept=".md" /&gt;",
faicon : "&lt;i class="fa fa-star" onclick="alert('faicon');"&gt;&lt;/i&gt;"
},
// 自定义工具栏按钮的事件处理
toolbarHandlers : {
/**
* @param {Object} cm CodeMirror对象
* @param {Object} icon 图标按钮jQuery元素对象
* @param {Object} cursor CodeMirror的光标对象,可获取光标所在行和位置
* @param {String} selection 编辑器选中的文本
*/
testIcon : function(cm, icon, cursor, selection) {
//var cursor = cm.getCursor(); //获取当前光标对象,同cursor参数
//var selection = cm.getSelection(); //获取当前选中的文本,同selection参数
// 替换选中文本,如果没有选中文本,则直接插入
cm.replaceSelection("[" + selection + ":testIcon]");
// 如果当前没有选中的文本,将光标移到要输入的位置
if(selection === "") {
cm.setCursor(cursor.line, cursor.ch + 1);
}
// this == 当前editormd实例
console.log("testIcon =>", this, cm, icon, cursor, selection);
},
testIcon2 : function(cm, icon, cursor, selection) {
cm.replaceSelection("[" + selection + ":testIcon2](" + icon.html() + ")");
console.log("testIcon2 =>", this, icon.html());
}
},
lang : {
toolbar : {
file : "上传文件",
testIcon : "自定义按钮testIcon", // 自定义按钮的提示文本,即title属性
testIcon2 : "自定义按钮testIcon2",
undo : "撤销 (Ctrl+Z)"
}
},
onload : function(){
$("[type=\"file\"]").bind("change", function(){
alert($(this).val());
testEditor.cm.replaceSelection($(this).val());
console.log($(this).val(), testEditor);
});
}
});
});
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<!-- 多语言和自定义工具栏的整合测试 -->
<script src="../languages/en.js"></script>
<script type="text/javascript">
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
watch : false,
toolbarIcons : function() {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["undo", "redo", "|", "bold", "hr", "|", "preview", "watch", "|", "fullscreen", "info", "testIcon", "testIcon2", "file", "faicon", "||", "watch", "fullscreen", "preview", "testIcon", "file"]
},
// toolbarIcons : "full", // You can also use editormd.toolbarModes[name] default list, values: full, simple, mini.
toolbarIconsClass : {
testIcon : "fa-gears" // 指定一个FontAawsome的图标类
},
toolbarIconTexts : {
testIcon2 : "测试按钮Test button" // 如果没有图标,则可以这样直接插入内容,可以是字符串或HTML标签
},
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
toolbarCustomIcons : {
file : "<input type=\"file\" accept=\".md\" />",
faicon : "<i class=\"fa fa-star\" onclick=\"alert('faicon');\"></i>"
},
// 自定义工具栏按钮的事件处理
toolbarHandlers : {
/**
* @param {Object} cm CodeMirror对象
* @param {Object} icon 图标按钮jQuery元素对象
* @param {Object} cursor CodeMirror的光标对象,可获取光标所在行和位置
* @param {String} selection 编辑器选中的文本
*/
testIcon : function(cm, icon, cursor, selection) {
//var cursor = cm.getCursor(); //获取当前光标对象,同cursor参数
//var selection = cm.getSelection(); //获取当前选中的文本,同selection参数
// 替换选中文本,如果没有选中文本,则直接插入
cm.replaceSelection("[" + selection + ":testIcon]");
// 如果当前没有选中的文本,将光标移到要输入的位置
if(selection === "") {
cm.setCursor(cursor.line, cursor.ch + 1);
}
// this == 当前editormd实例
console.log("testIcon =>", this, cm, icon, cursor, selection);
},
testIcon2 : function(cm, icon, cursor, selection) {
cm.replaceSelection("[" + selection + ":testIcon2](" + icon.html() + ")");
console.log("testIcon2 =>", this, icon.html());
}
},
lang : {
toolbar : {
file : "上传文件",
testIcon : "自定义按钮testIcon", // 自定义按钮的提示文本,即title属性
testIcon2 : "自定义按钮testIcon2",
undo : "撤销 (Ctrl+Z)"
}
},
onload : function(){
$("[type=\"file\"]").bind("change", function(){
alert($(this).val());
testEditor.cm.replaceSelection($(this).val());
console.log($(this).val(), testEditor);
});
}
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Define extention plugins for Editor.md - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Define extention plugins for Editor.md</h1>
</header>
<div id="test-editormd">
<textarea style="display:none;">[TOC]
### Define plugin
#### Plugin directory
editor.md/
plugins/
plugin-name/
....
#### Example
```javascript
(function() {
var factory = function (exports) {
var $ = jQuery; // if using module loader(Require.js/Sea.js).
exports.customMethod = function() {
//....
};
exports.fn.youPluginName = function() {
/*
var _this = this; // this == the current instance object of Editor.md
var lang = this.lang;
var settings = this.settings;
var editor = this.editor;
var cursor = cm.getCursor();
var selection = cm.getSelection();
cm.focus();
*/
//....
};
};
// CommonJS/Node.js
if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
{
module.exports = factory;
}
else if (typeof define === "function") // AMD/CMD/Sea.js
{
if (define.amd) { // for Require.js
define(["editormd"], function(editormd) {
factory(editormd);
});
} else { // for Sea.js
define(function(require) {
var editormd = require("./../../editormd");
factory(editormd);
});
}
}
else
{
factory(window.editormd);
}
})();
```
#### Usage plugin
```html
&lt;script src="../plugins/you-plugin-name/you-plugin-name.js"&gt;&lt;/script&gt;
&lt;script&gt;
editormd.customMethod();
var testEditor = editormd("test-editormd", {
path : '../lib/',
onload : function() {
this.youPluginName();
this.pluginA();
this.executePlugin("somePluginName", "you-plugin-name/you-plugin-name"); // load and execute plugin
}
});
// or
$("#btn").click(function(){
testEditor.youPluginName();
});
&lt;/script&gt;
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
editormd.fn.customMethod = function() {
console.log("customMethod", this);
};
editormd.fn.pluginA = function() {
console.log("pluginA", this);
};
$(function() {
editormd.methodOne = function(){
console.log("editormd.methodOne");
};
editormd.loadPlugin("../plugins/test-plugin/test-plugin", function(){
editormd.testPlugin();
});
editormd.loadPlugin("../plugins/image-dialog/image-dialog", function(){
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
path : '../lib/',
onload : function() {
this.customMethod();
testEditor.imageDialog();
this.executePlugin("htmlEntitiesDialog", "html-entities-dialog/html-entities-dialog"); // load and execute plugin
this.pluginA();
}
}); // execute plugin
});
editormd.methodOne();
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Delay Rerender & Preview - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Delay Rerender & Preview</h1>
<p>P.S. If you input the content too much and too fast, You can setting the delay value. </p>
<p>P.S. 适用于输入内容太多太快的情形,但要是一个合理的值,不然会显得预览太慢。打字慢会相对显得慢,打字快时则相对显得快。</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Setting
{
delay : 300 // Uint : ms, default value is 300, and this example is set value 1000
}
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
$.get("test.md", function(md) {
testEditor = editormd("test-editormd", {
width : "90%",
height : 640,
path : "../lib/",
delay : 1000,
appendMarkdown : md,
codeFold : true,
saveHTMLToTextarea : true,
searchReplace : true,
htmlDecode : "style,script,iframe",
emoji : true,
taskList : true,
tex : true,
flowChart : true,
sequenceDiagram : true
});
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>动态创建 Editor.md - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>动态创建 Editor.md</h1>
<p>Dynamic create Editor.md</p>
<br/>
<div class="btns" style="margin:0;">
<button id="create-btn">动态创建一个 Editor.md</button>
<button id="remove-btn">移除 Editor.md</button>
</div>
</header>
</div>
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
var testEditormd;
$(function() {
$("#create-btn").click(function(){
$.getScript("../editormd.js", function() {
$("#layout").append("<div id=\"test-editormd\"></div>");
testEditormd = editormd("test-editormd", {
width: "90%",
height: 640,
markdown : "### 动态创建 Editor.md\r\n\r\nDynamic create Editor.md",
path : '../lib/'
});
});
});
$("#remove-btn").click(function() {
testEditormd.editor.remove();
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Emoji - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
<style>
</style>
</head>
<body>
<div id="layout">
<header>
<h1>Emoji 表情</h1>
<p>Supports:</p>
<ul style="margin: 10px 0 0 18px;">
<li>Github emoji : <a href="http://www.emoji-cheat-sheet.com/" target="_blank">http://www.emoji-cheat-sheet.com/</a></li>
<li>Twitter Emoji(Twemoji) : <a href="http://twitter.github.io/twemoji/preview.html" target="_blank">http://twitter.github.io/twemoji/preview.html</a></li>
<li>FontAwesome icon font emoji : <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a></li>
<li>Editor.md logo icon font emoji</li>
</ul>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Emoji 表情 :smiley:
[TOC]
### Emoji
Emoji cheat sheet for Campfire and GitHub.
[http://www.emoji-cheat-sheet.com/](http://www.emoji-cheat-sheet.com/)
**Usage:**
:emoji-name:
**Examples:**
:heart: :smiley: :+1: :-1: :black_large_square: :waxing_gibbous_moon: :moon: :crescent_moon:
### Twitter Emoji (Twemoji)
**Usage:**
:tw-xxxx:
**Examples:**
:tw-1f504: :tw-30-20e3: :tw-31-20e3: :tw-32-20e3: :tw-33-20e3: :tw-34-20e3: :tw-35-20e3: :tw-36-20e3: :tw-37-20e3: :tw-38-20e3: :tw-39-20e3: :tw-1f51f:
[http://twitter.github.io/twemoji/preview.html](http://twitter.github.io/twemoji/preview.html)
### Fortawesome icons
[http://fortawesome.github.io/Font-Awesome/icons/](http://fortawesome.github.io/Font-Awesome/icons/)
**Usage:**
:fa-xxxx:
**Examples:**
:fa-wifi: :fa-twitter: :fa-google-plus: :fa-git-square: :fa-github-alt: :fa-external-link-square:
### Editor.md logos
**Usage:**
:editormd-logo:
:editormd-logo-1x:
...
:editormd-logo-8x:
**Examples:**
:editormd-logo: :editormd-logo-1x: :editormd-logo-2x: :editormd-logo-3x: :editormd-logo-4x: :editormd-logo-5x: :editormd-logo-6x: :editormd-logo-7x: :editormd-logo-8x:
### Mixed tests
&gt; Blockquotes :star:
@pandao dasfsadfasdf:fa-edit: :warning: :smiley:dsafsdfsad\:fdsfdf\:f dfdf: :fa-save::fa-star: :fa-truck:
**fdfasd:smiley:dsfsdfsfd** ~~fsdfds:smiley:dfsdfsdf :fa-info:~~ @pandao
:fa-weixin: :fa-qq: :fa-weibo: :fa-tencent-weibo: :fa-github: :fa-git:
*dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf*
___Emphasis :fa-gear: Italic:smiley:___ __Emphasis:smiley:__
# H1 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
## H2 dsfd:fa-star:fsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-star:
### H3 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf @pandao
#### H4 dsfdfsfd@pandao :smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
##### H5 dsfdfsfd:smiley:dsfsfd @pandao sfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-save:dsfsdf
###### H6 dsfdfsfd:smiley:dsfsfdsfd:smiley:dsfdf:fa-edit: fdsfsdf:fa-star:dsfsdf
[:smiley:](http://www.emoji-cheat-sheet.com/ "link + emoji") link + emoji
- dafs@pandao sdfsdaf:smiley:dfsdfsdf
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafssdfsdaf:smiley:dfsdfsdf
- dafss:fa-truck:dfsdaf:smiley:dfsd @pandao fsdf
- dafssd: :fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
+ dafssdfsdaf:smiley:dfsdfsdf @pandao
+ dafs@pandao s:fa-truck:dfsdaf:smiley:dfsdfsdf
1. :smiley:第一行:fa-truck:fsdaf:smiley:dfs@pandao dfsdf :fa-save:: :fa-truck:
- dafssdfsdaf:smiley:dfsdfsdf @pandao
- dafss:fa-truck:dfsdaf:smiley:dfsdfsdf
2. :smiley:第二行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-star:: :fa-truck:
3. 第三行:fa-truck:fsdaf:smiley:dfsdfsdf :fa-save:: :fa-truck:
&gt; Blockquotes @pandao
&gt; dd:smiley:引用文本(Blockquotes:smiley:)fdasfad :fa-star:: dfd :fa-truck: @pandao
#### Datetime test
02:21:47
2015-03-12 02:21:47
### In table
|:100: First Header | Second:smiley: Header:smiley: |
| ------------- | ------------- |
| Content:fa-truck: Cell | :smiley:Content Cell :smiley: |
| Con:fa-truck:tent Cell:bangbang: | Content Cell dfsdfsdf :fa-star: :dfdf :fa-truck: |
### Editor.md logo emoji
:fa-heart:fasdfsdfsfddffd:editormd-logo: :editormd-logo: :editormd-logo-4x:
dfasfasdfasdf:bangbang:
This is an H1 :editormd-logo-4x: @pandao
=============
@pandao This :fa-save:: :fa-truck:is an H2 :100:
-------------
### GFM task lists :editormd-logo-5x:
- [x] :smiley: @mentions, :smiley: #refs, [links](), **formatting**, and <del>tags</del> supported :editormd-logo:;
- [x] list syntax required (any unordered or ordered list supported) :editormd-logo-3x:;
- [x] [ ] :smiley: this is a complete item :smiley:;
- [ ] []this is an incomplete item [test link](#) :fa-star: @pandao;
- [ ] [ ]this is an incomplete item;
- [ ] :smiley: this is an incomplete item [test link](#);
- [ ] :smiley: this is an incomplete item [test link](#);
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
// You can custom Emoji's graphics files url path
editormd.emoji = {
path : "http://www.emoji-cheat-sheet.com/graphics/emojis/",
ext : ".png"
};
// Twitter Emoji (Twemoji) graphics files url path
editormd.twemoji = {
path : "http://twemoji.maxcdn.com/72x72/",
ext : ".png"
};
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
toc : true,
emoji : true, // Support Github emoji, Twitter Emoji(Twemoji), fontAwesome, Editor.md logo emojis.
taskList : true,
path : '../lib/'
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Expanded Editor.md - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Expanded Editor.md</h1>
<p>Expanded of member methods and properties</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">### Expanded Editor.md
```javascript
var testEditor;
function EditormdExtend() {
this.extend("methodC", function() {
console.log("methodC");
});
// or
testEditor.extend("methodA", function() {
console.log("methodA");
});
// one by one setting
this.set("propertyA", "propertyA");
this.set("methodE", function() {
console.log("mothodE", this);
});
// mutil
this.extend({
propertyA : "propertyAAAA", // override, you can override other default method.
propertyB : "propertyB",
methodD : function() {
console.log("methodD");
}
});
this.methodB = function() {
console.log("methodB");
};
testEditor.methodA();
testEditor.methodB();
this.methodC();
this.methodE();
editormd.methodOne();
console.log(this, this.propertyA);
}
editormd.fn.customMethod = function(){
console.log("customMethod", this);
};
$(function() {
editormd.methodOne = function(){
console.log("editormd.methodOne");
};
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
path : '../lib/',
onload : function() {
this.customMethod();
$.proxy(EditormdExtend, this)();
}
});
editormd.methodOne();
});
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
function EditormdExtend() {
this.extend("methodC", function() {
console.log("methodC");
});
// or
testEditor.extend("methodA", function() {
console.log("methodA");
});
// one by one setting
this.set("propertyA", "propertyA");
this.set("methodE", function() {
console.log("mothodE", this);
});
// mutil
this.extend({
propertyA : "propertyAAAA", // override, you can override other default method.
propertyB : "propertyB",
methodD : function() {
console.log("methodD");
}
});
this.methodB = function() {
console.log("methodB");
};
testEditor.methodA();
testEditor.methodB();
this.methodC();
this.methodE();
editormd.methodOne();
console.log(this, this.propertyA);
}
editormd.fn.customMethod = function() {
console.log("customMethod", this);
};
$(function() {
editormd.methodOne = function() {
console.log("editormd.methodOne");
};
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
path : '../lib/',
onload : function() {
this.customMethod();
$.proxy(EditormdExtend, this)();
}
});
editormd.methodOne();
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>External use - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>External use</h1>
<p>External use of toolbar handlers / modal dialog</p>
</header>
<div class="btns">
<button id="undo">Undo</button>
<button id="open-link-dialog">Open link dialog</button>
<button id="insert-bold">Insert Bold</button>
<button id="insert-h6">Insert Heading 6</button>
<button id="insert-inline-code">Insert Inline code</button>
<button id="open-image-dialog">Open image dialog</button>
<button id="open-help-dialog">Open help dialog</button>
<button id="open-html-entities-dialog">Open html entities dialog</button>
</div>
<div id="test-editormd">
<textarea style="display:none;">[TOC]
### External use of toolbar handlers / modal dialog
```javascript
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
path : '../lib/'
});
// the first method
$("#undo").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.undo, testEditor)();
});
// the Second method : using manually loaded dialog plugin
// &lt;script src="../plugins/html-entities/html-entities.js"&gt;&lt;/script&gt;
$("#open-html-entities-dialog").bind('click', function() {
testEditor.htmlEntities();
});
// using toolbar dialog plugin
$("#open-link-dialog").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.link, testEditor)();
});
// or
$("#open-image-dialog").bind('click', function(){
// load and execute plugin
testEditor.executePlugin("imageDialog", "../plugins/image-dialog/image-dialog");
});
```
</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<!-- manually load dialog plugin -->
<script src="../plugins/html-entities-dialog/html-entities-dialog.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
path : '../lib/'
});
// the first method
$("#undo").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.undo, testEditor)();
});
// the Second method : using manually loaded dialog plugin
$("#open-html-entities-dialog").bind('click', function() {
testEditor.htmlEntitiesDialog();
});
$("#insert-bold").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.bold, testEditor)();
testEditor.focus();
});
$("#insert-h6").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.h6, testEditor)();
testEditor.focus();
});
$("#insert-inline-code").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.code, testEditor)();
testEditor.focus();
});
$("#open-help-dialog").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.help, testEditor)();
});
// using toolbar dialog plugin
$("#open-link-dialog").bind('click', function() {
$.proxy(testEditor.toolbarHandlers.link, testEditor)();
});
// or
$("#open-image-dialog").bind('click', function(){
testEditor.executePlugin("imageDialog", "../plugins/image-dialog/image-dialog"); // load and execute plugin
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>FlowChart - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>FlowChart 流程图</h1>
<p>Based on flowchart.js:<a href="http://adrai.github.io/flowchart.js/" target="_blank">http://adrai.github.io/flowchart.js/</a></p>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Using FlowChart
setting:
{
flowChart : true
}
#### Example
```flow
st=>start: User login
op=>operation: Operation
cond=>condition: Successful Yes or No?
e=>end: Into admin
st->op->cond
cond(yes)->e
cond(no)->op
```</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
flowChart : true
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Form get textarea value - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>表单取值</h1>
<p>Form get textarea value.</p>
</header>
<form method="post" action="http://editormd.ipandao.com/php/post.php">
<div id="test-editormd">
<!-- Custom textarea name attribute <textarea style="display:none;" name="test-textarea-name"> -->
<textarea style="display:none;">#### Get value
每个 Editor.md 的 ID 元素下都有一个保存 Markdown 源码的 Textarea,你也可以通过设置开启另一个保存 HTML 源码的 Textarea,可以按需要获取相应的值,如下:
```html
&lt;div class="editormd" id="$id"&gt;
&lt;textarea class="editormd-markdown-textarea" name="$id-markdown-doc"&gt;&lt;/textarea&gt;
&lt;!-- html textarea 需要开启配置项 saveHTMLToTextarea == true --&gt;
&lt;textarea class="editormd-html-textarea" name="$id-html-code"&gt;&lt;/textarea&gt;
&lt;/div&gt;
```
#### Example
```javascript
var testEditor = editormd("test-editormd", {
width : "90%",
height : 640,
path : "../lib/",
saveHTMLToTextarea : true
});
testEditor.getMarkdown(); // 获取 Markdown 源码
testEditor.getHTML(); // 获取 Textarea 保存的 HTML 源码
testEditor.getPreviewedHTML(); // 获取预览窗口里的 HTML,在开启 watch 且没有开启 saveHTMLToTextarea 时使用
```
#### Backend get form value
假设编辑器 ID 为 `test-editormd`,以 PHP 为例:
```php
<?php
header("Content-Type:text/html; charset=utf-8");
if (isset($_POST['submit'])) {
echo "<pre>";
echo htmlspecialchars($_POST["test-editormd-markdown-doc"]);
echo "<br/><br/>";
echo htmlspecialchars($_POST["test-editormd-html-code"]);
echo "</pre>";
}
?>
```
</textarea>
</div>
<div style="width:90%;margin: 10px auto;">
<input type="submit" name="submit" value="提交表单 Submit" style="padding: 5px;" />
</div>
</form>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
$.get("./test.md", function(md) {
var testEditor = editormd("test-editormd", {
width : "90%",
height : 640,
path : "../lib/",
appendMarkdown : md,
saveHTMLToTextarea : true
});
});
//testEditor.getMarkdown(); // 获取 Markdown 源码
//testEditor.getHTML(); // 获取 Textarea 保存的 HTML 源码
//testEditor.getPreviewedHTML(); // 获取预览窗口里的 HTML,在开启 watch 且没有开启 saveHTMLToTextarea 时使用
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>Goto line - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout">
<header>
<h1>Goto line</h1>
</header>
<div class="btns">
<button id="goto-line-btn">Goto line 90</button>
<button id="goto-line-150-btn">Goto line 150</button>
<button id="goto-line-240-btn">Goto line 240</button>
<button id="goto-line-300-btn">Goto line 300</button>
<button id="goto-line-400-btn">Goto line 400</button>
<button id="goto-first-line-btn">Goto first line</button>
<button id="goto-last-line-btn">Goto last line</button>
</div>
<div id="test-editormd"></div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
var testEditor;
$(function() {
$.get("test.md", function(md){
testEditor = editormd("test-editormd", {
width : "90%",
height : 740,
path : "../lib/",
markdown : md,
codeFold : true,
htmlDecode : "style,script,iframe",
tex : true,
emoji : true,
taskList : true,
flowChart : true,
sequenceDiagram : true,
//gotoLine : false // disabled
});
});
$("#goto-line-btn").bind("click", function(){
testEditor.gotoLine(90);
});
$("#goto-line-150-btn").bind("click", function(){
testEditor.gotoLine(150);
});
$("#goto-line-240-btn").bind("click", function(){
testEditor.gotoLine(240);
});
$("#goto-line-300-btn").bind("click", function(){
testEditor.gotoLine(300);
});
$("#goto-line-400-btn").bind("click", function(){
testEditor.gotoLine(400);
});
$("#goto-first-line-btn").bind("click", function(){
testEditor.gotoLine("first");
// or
//testEditor.gotoLine(1);
});
$("#goto-last-line-btn").bind("click", function(){
testEditor.gotoLine("last");
// or
//testEditor.gotoLine(testEditor.cm.lineCount());
});
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<title>图片上传示例 - Editor.md examples</title>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="../css/editormd.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
</head>
<body>
<div id="layout" style="height: 2000px;background: #f6f6f6;">
<header>
<h1>图片上传示例</h1>
<p>Image upload example</p>
</header>
<div id="test-editormd">
<textarea style="display:none;">#### Settings
```javascript
{
imageUpload : false,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php",
}
```
#### JSON data
```json
{
success : 0 | 1, // 0 表示上传失败,1 表示上传成功
message : "提示的信息,上传成功或上传失败及错误信息等。",
url : "图片地址" // 上传成功时才返回
}
```</textarea>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="../editormd.js"></script>
<script type="text/javascript">
$(function() {
var testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
markdown : "",
path : '../lib/',
//dialogLockScreen : false, // 设置弹出层对话框不锁屏,全局通用,默认为 true
//dialogShowMask : false, // 设置弹出层对话框显示透明遮罩层,全局通用,默认为 true
//dialogDraggable : false, // 设置弹出层对话框不可拖动,全局通用,默认为 true
//dialogMaskOpacity : 0.4, // 设置透明遮罩层的透明度,全局通用,默认值为 0.1
//dialogMaskBgColor : "#000", // 设置透明遮罩层的背景颜色,全局通用,默认为 #fff
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php?test=dfdf",
/*
上传的后台只需要返回一个 JSON 数据,结构如下:
{
success : 0 | 1, // 0 表示上传失败,1 表示上传成功
message : "提示的信息,上传成功或上传失败及错误信息等。",
url : "图片地址" // 上传成功时才返回
}
*/
});
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?php
header("Content-Type:text/html; charset=utf-8");
header("Access-Control-Allow-Origin: *");
if (isset($_POST['submit'])) {
echo "<pre>";
echo htmlspecialchars($_POST["test-editormd-markdown-doc"]);
if(isset($_POST["test-editormd-html-code"])) {
echo "<br/><br/>";
echo htmlspecialchars($_POST["test-editormd-html-code"]);
}
echo "</pre>";
}
exit;
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment