diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..53fb05154 Binary files /dev/null and b/.DS_Store differ diff --git a/public/css/.DS_Store b/public/css/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/public/css/.DS_Store differ diff --git a/public/css/simditor.css b/public/css/simditor.css new file mode 100644 index 000000000..341ae827d --- /dev/null +++ b/public/css/simditor.css @@ -0,0 +1,746 @@ +/*! +* Simditor v2.3.6 +* http://simditor.tower.im/ +* 2015-12-21 +*/ +@font-face { + font-family: 'Simditor'; + src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABp8AA4AAAAAKmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAaYAAAABoAAAAcdO8GE09TLzIAAAG0AAAARQAAAGAQ+ZFXY21hcAAAAkgAAABRAAABWuA2Gx9jdnQgAAAEgAAAAAoAAAAKAwQAxGZwZ20AAAKcAAABsQAAAmUPtC+nZ2x5ZgAABNgAABPeAAAgZG/p6QxoZWFkAAABRAAAADAAAAA2BvuCgGhoZWEAAAF0AAAAHgAAACQH9QTlaG10eAAAAfwAAABKAAAAlHv7AItsb2NhAAAEjAAAAEwAAABMi4qTXm1heHAAAAGUAAAAIAAAACABRwHNbmFtZQAAGLgAAAEFAAAB12vS/ulwb3N0AAAZwAAAAJ4AAAFsyCrvunByZXAAAARQAAAALgAAAC6w8isUeNpjYGRgYADiKAkPy3h+m68M8swfgCIMF0/IVyDo/84sFswJQC4HAxNIFAAZwAnyeNpjYGRgYE5gmMAQzWLBwPD/O5AEiqAAVQBa6wPkAAAAAQAAACUAoAAKAAAAAAACAAEAAgAWAAABAAEpAAAAAHjaY2BhnsA4gYGVgYGpn+kgAwNDL4RmfMxgxMgCFGVgZWaAAUYBBjTQwMDwQY454X8BQzRzAsMEIJcRSVaBgREAQ9oK6QAAAHjaY8xhUGQAAsYABgbmDwjMYsEgxCzBwMDkAOQnALEEgx1UjhN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1b5EN8hGS1i51e2tdsAsDkIPGYliDdesazes7CRI9OdoekjR6bxa8mk4OL7XB7OJ3aGoMLP4ddyVS7j5kK/36mLGfHnojgBj4/h49BOiPiadnfd9BGRDfJ9nKua6657hIdVGMMiWEOnOmvoYoT+C93/Vj8AAHjafY+/asMwEIc/JU6aQhsyltJBQ6eCg20IgdCt1GTwlNJsHUJijCCxwHaeqVufpM/Qta/Ri31ZOkTipO9Ov/sjYMwXhm7d8qBsGPGs3OOKd+U+j3wqB6L5UR5wY4zykJGxojTBtXj3bdaJDROelHvS91W5z5IP5UA038oD7vhVHjIxY1I8JQ2ObUs1lkz2C6S+bNzWl7XNMnHfRHNgJ2cjykoC7rBzjRdakVNwZM/m9LDKi+N+I3AunrYJhagsCVMiuRdi/0t20Vg0IXOxRJQxs26U1FdFbpNpZBf23FowTsJ5mETx7OKEa+ldyedcO9GpRzcF67yqnS9tLHUvVfgDz/ZF8gAAAHjabc25DgFhGIXh/53B2Pd9J9HPN/bSWolC4iI0OjfgxhFO6SQnT/k6z333errI/dvkc5yHh+98YsRJEJAkRZoMWXLkKVCkRJkKVWrUadCkRZsOXXr0GTBkxDh2vp5O3u4SPO63YxiG0mQkp3Im53Ihl3Il13Ijt3In9/Igjz9NfVPf1Df1TX1T39Q39U19U9/UN/VNfVPfDm8tR0peAAB42mNgYGBkAIKLcceVwfQJ+XIoXQEARe8GegAA) format("woff"); + font-weight: normal; + font-style: normal; +} +.simditor-icon { + display: inline-block; + font: normal normal normal 14px/1 'Simditor'; + font-size: inherit; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + transform: translate(0, 0); +} + +.simditor-icon-code:before { + content: '\f000'; +} + +.simditor-icon-bold:before { + content: '\f001'; +} + +.simditor-icon-italic:before { + content: '\f002'; +} + +.simditor-icon-underline:before { + content: '\f003'; +} + +.simditor-icon-times:before { + content: '\f004'; +} + +.simditor-icon-strikethrough:before { + content: '\f005'; +} + +.simditor-icon-list-ol:before { + content: '\f006'; +} + +.simditor-icon-list-ul:before { + content: '\f007'; +} + +.simditor-icon-quote-left:before { + content: '\f008'; +} + +.simditor-icon-table:before { + content: '\f009'; +} + +.simditor-icon-link:before { + content: '\f00a'; +} + +.simditor-icon-picture-o:before { + content: '\f00b'; +} + +.simditor-icon-minus:before { + content: '\f00c'; +} + +.simditor-icon-indent:before { + content: '\f00d'; +} + +.simditor-icon-outdent:before { + content: '\f00e'; +} + +.simditor-icon-unlink:before { + content: '\f00f'; +} + +.simditor-icon-caret-down:before { + content: '\f010'; +} + +.simditor-icon-caret-right:before { + content: '\f011'; +} + +.simditor-icon-upload:before { + content: '\f012'; +} + +.simditor-icon-undo:before { + content: '\f013'; +} + +.simditor-icon-smile-o:before { + content: '\f014'; +} + +.simditor-icon-tint:before { + content: '\f015'; +} + +.simditor-icon-font:before { + content: '\f016'; +} + +.simditor-icon-html5:before { + content: '\f017'; +} + +.simditor-icon-mark:before { + content: '\f018'; +} + +.simditor-icon-align-center:before { + content: '\f019'; +} + +.simditor-icon-align-left:before { + content: '\f01a'; +} + +.simditor-icon-align-right:before { + content: '\f01b'; +} + +.simditor-icon-font-minus:before { + content: '\f01c'; +} + +.simditor-icon-markdown:before { + content: '\f01d'; +} + +.simditor-icon-checklist:before { + content: '\f01e'; +} + +.simditor { + position: relative; + border: 1px solid #c9d8db; +} +.simditor .simditor-wrapper { + position: relative; + background: #ffffff; +} +.simditor .simditor-wrapper > textarea { + display: none !important; + width: 100%; + box-sizing: border-box; + font-family: monaco; + font-size: 16px; + line-height: 1.6; + border: none; + padding: 22px 15px 40px; + min-height: 300px; + outline: none; + background: transparent; + resize: none; +} +.simditor .simditor-wrapper .simditor-placeholder { + display: none; + position: absolute; + left: 0; + z-index: 0; + padding: 22px 15px; + font-size: 16px; + font-family: arial, sans-serif; + line-height: 1.5; + color: #999999; + background: transparent; +} +.simditor .simditor-wrapper.toolbar-floating .simditor-toolbar { + position: fixed; + top: 0; + z-index: 10; + box-shadow: 0 0 6px rgba(0, 0, 0, 0.1); +} +.simditor .simditor-wrapper .simditor-image-loading { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 2; +} +.simditor .simditor-wrapper .simditor-image-loading .progress { + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.4); + position: absolute; + bottom: 0; + left: 0; +} +.simditor .simditor-body { + padding: 22px 15px 40px; + min-height: 300px; + outline: none; + cursor: text; + position: relative; + z-index: 1; + background: transparent; +} +.simditor .simditor-body a.selected { + background: #b3d4fd; +} +.simditor .simditor-body a.simditor-mention { + cursor: pointer; +} +.simditor .simditor-body .simditor-table { + position: relative; +} +.simditor .simditor-body .simditor-table.resizing { + cursor: col-resize; +} +.simditor .simditor-body .simditor-table .simditor-resize-handle { + position: absolute; + left: 0; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; +} +.simditor .simditor-body pre { + /*min-height: 28px;*/ + box-sizing: border-box; + -moz-box-sizing: border-box; + word-wrap: break-word !important; + white-space: pre-wrap !important; +} +.simditor .simditor-body img { + cursor: pointer; +} +.simditor .simditor-body img.selected { + box-shadow: 0 0 0 4px #cccccc; +} +.simditor .simditor-paste-bin { + position: fixed; + bottom: 10px; + right: 10px; + width: 1px; + height: 20px; + font-size: 1px; + line-height: 1px; + overflow: hidden; + padding: 0; + margin: 0; + opacity: 0; + -webkit-user-select: text; +} +.simditor .simditor-toolbar { + border-bottom: 1px solid #eeeeee; + background: #ffffff; + width: 100%; +} +.simditor .simditor-toolbar > ul { + margin: 0; + padding: 0 0 0 6px; + list-style: none; +} +.simditor .simditor-toolbar > ul > li { + position: relative; + display: inline-block; + font-size: 0; +} +.simditor .simditor-toolbar > ul > li > span.separator { + display: inline-block; + background: #cfcfcf; + width: 1px; + height: 18px; + margin: 11px 15px; + vertical-align: middle; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item { + display: inline-block; + width: 46px; + height: 40px; + outline: none; + color: #333333; + font-size: 15px; + line-height: 40px; + vertical-align: middle; + text-align: center; + text-decoration: none; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item span { + opacity: 0.6; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item span.simditor-icon { + display: inline; + line-height: normal; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item:hover span { + opacity: 1; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.active { + background: #eeeeee; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.active span { + opacity: 1; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.disabled { + cursor: default; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.disabled span { + opacity: 0.3; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title span:before { + content: "H"; + font-size: 19px; + font-weight: bold; + font-family: 'Times New Roman'; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h1 span:before { + content: 'H1'; + font-size: 18px; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h2 span:before { + content: 'H2'; + font-size: 18px; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-title.active-h3 span:before { + content: 'H3'; + font-size: 18px; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-image { + position: relative; + overflow: hidden; +} +.simditor .simditor-toolbar > ul > li > .toolbar-item.toolbar-item-image > input[type=file] { + position: absolute; + right: 0px; + top: 0px; + opacity: 0; + font-size: 100px; + cursor: pointer; +} +.simditor .simditor-toolbar > ul > li.menu-on .toolbar-item { + position: relative; + z-index: 20; + background: #ffffff; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); +} +.simditor .simditor-toolbar > ul > li.menu-on .toolbar-item span { + opacity: 1; +} +.simditor .simditor-toolbar > ul > li.menu-on .toolbar-menu { + display: block; +} +.simditor .simditor-toolbar .toolbar-menu { + display: none; + position: absolute; + top: 40px; + left: 0; + z-index: 21; + background: #ffffff; + text-align: left; + box-shadow: 0 0 4px rgba(0, 0, 0, 0.3); +} +.simditor .simditor-toolbar .toolbar-menu:before { + content: ''; + display: block; + width: 46px; + height: 4px; + background: #ffffff; + position: absolute; + top: -3px; + left: 0; +} +.simditor .simditor-toolbar .toolbar-menu ul { + min-width: 160px; + list-style: none; + margin: 0; + padding: 10px 1px; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item { + display: block; + font-size: 16px; + line-height: 2em; + padding: 0 10px; + text-decoration: none; + color: #666666; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item:hover { + background: #f6f6f6; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h1 { + font-size: 24px; + color: #333333; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h2 { + font-size: 22px; + color: #333333; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h3 { + font-size: 20px; + color: #333333; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h4 { + font-size: 18px; + color: #333333; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .menu-item.menu-item-h5 { + font-size: 16px; + color: #333333; +} +.simditor .simditor-toolbar .toolbar-menu ul > li .separator { + display: block; + border-top: 1px solid #cccccc; + height: 0; + line-height: 0; + font-size: 0; + margin: 6px 0; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color { + width: 96px; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list { + height: 40px; + margin: 10px 6px 6px 10px; + padding: 0; + min-width: 0; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li { + float: left; + margin: 0 4px 4px 0; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color { + display: block; + width: 16px; + height: 16px; + background: #dfdfdf; + border-radius: 2px; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color:hover { + opacity: 0.8; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color.font-color-default { + background: #333333; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-1 { + background: #E33737; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-2 { + background: #e28b41; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-3 { + background: #c8a732; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-4 { + background: #209361; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-5 { + background: #418caf; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-6 { + background: #aa8773; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-color .color-list li .font-color-7 { + background: #999999; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table { + background: #ffffff; + padding: 1px; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table { + border: none; + border-collapse: collapse; + border-spacing: 0; + table-layout: fixed; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td { + padding: 0; + cursor: pointer; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td:before { + width: 16px; + height: 16px; + border: 1px solid #ffffff; + background: #f3f3f3; + display: block; + content: ""; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-create-table table td.selected:before { + background: #cfcfcf; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table { + display: none; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-table .menu-edit-table ul li { + white-space: nowrap; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image { + position: relative; + overflow: hidden; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-image .menu-item-upload-image input[type=file] { + position: absolute; + right: 0px; + top: 0px; + opacity: 0; + font-size: 100px; + cursor: pointer; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment { + width: 100%; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment ul { + min-width: 100%; +} +.simditor .simditor-toolbar .toolbar-menu.toolbar-menu-alignment .menu-item { + text-align: center; +} +.simditor .simditor-popover { + display: none; + padding: 5px 8px 0; + background: #ffffff; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); + border-radius: 2px; + position: absolute; + z-index: 2; +} +.simditor .simditor-popover .settings-field { + margin: 0 0 5px 0; + font-size: 12px; + height: 25px; + line-height: 25px; +} +.simditor .simditor-popover .settings-field label { + display: inline-block; + margin: 0 5px 0 0; +} +.simditor .simditor-popover .settings-field input[type=text] { + display: inline-block; + width: 200px; + box-sizing: border-box; + font-size: 12px; +} +.simditor .simditor-popover .settings-field input[type=text].image-size { + width: 83px; +} +.simditor .simditor-popover .settings-field .times { + display: inline-block; + width: 26px; + font-size: 12px; + text-align: center; +} +.simditor .simditor-popover.link-popover .btn-unlink, .simditor .simditor-popover.image-popover .btn-upload, .simditor .simditor-popover.image-popover .btn-restore { + display: inline-block; + margin: 0 0 0 5px; + color: #333333; + font-size: 14px; + outline: 0; +} +.simditor .simditor-popover.link-popover .btn-unlink span, .simditor .simditor-popover.image-popover .btn-upload span, .simditor .simditor-popover.image-popover .btn-restore span { + opacity: 0.6; +} +.simditor .simditor-popover.link-popover .btn-unlink:hover span, .simditor .simditor-popover.image-popover .btn-upload:hover span, .simditor .simditor-popover.image-popover .btn-restore:hover span { + opacity: 1; +} +.simditor .simditor-popover.image-popover .btn-upload { + position: relative; + display: inline-block; + overflow: hidden; + vertical-align: middle; +} +.simditor .simditor-popover.image-popover .btn-upload input[type=file] { + position: absolute; + right: 0px; + top: 0px; + opacity: 0; + height: 100%; + width: 28px; +} +.simditor.simditor-mobile .simditor-wrapper.toolbar-floating .simditor-toolbar { + position: absolute; + top: 0; + z-index: 10; + box-shadow: 0 0 6px rgba(0, 0, 0, 0.1); +} + +.simditor .simditor-body, .editor-style { + font-size: 16px; + font-family: arial, sans-serif; + line-height: 1.6; + color: #333; + outline: none; + word-wrap: break-word; +} +.simditor .simditor-body > :first-child, .editor-style > :first-child { + margin-top: 0 !important; +} +.simditor .simditor-body a, .editor-style a { + color: #4298BA; + text-decoration: none; + word-break: break-all; +} +.simditor .simditor-body a:visited, .editor-style a:visited { + color: #4298BA; +} +.simditor .simditor-body a:hover, .editor-style a:hover { + color: #0F769F; +} +.simditor .simditor-body a:active, .editor-style a:active { + color: #9E792E; +} +.simditor .simditor-body a:hover, .simditor .simditor-body a:active, .editor-style a:hover, .editor-style a:active { + outline: 0; +} +.simditor .simditor-body h1, .simditor .simditor-body h2, .simditor .simditor-body h3, .simditor .simditor-body h4, .simditor .simditor-body h5, .simditor .simditor-body h6, .editor-style h1, .editor-style h2, .editor-style h3, .editor-style h4, .editor-style h5, .editor-style h6 { + font-weight: normal; + margin: 40px 0 20px; + color: #000000; +} +.simditor .simditor-body h1, .editor-style h1 { + font-size: 24px; +} +.simditor .simditor-body h2, .editor-style h2 { + font-size: 22px; +} +.simditor .simditor-body h3, .editor-style h3 { + font-size: 20px; +} +.simditor .simditor-body h4, .editor-style h4 { + font-size: 18px; +} +.simditor .simditor-body h5, .editor-style h5 { + font-size: 16px; +} +.simditor .simditor-body h6, .editor-style h6 { + font-size: 16px; +} +.simditor .simditor-body p, .simditor .simditor-body div, .editor-style p, .editor-style div { + word-wrap: break-word; + margin: 0 0 15px 0; + color: #333; + word-wrap: break-word; +} +.simditor .simditor-body b, .simditor .simditor-body strong, .editor-style b, .editor-style strong { + font-weight: bold; +} +.simditor .simditor-body i, .simditor .simditor-body em, .editor-style i, .editor-style em { + font-style: italic; +} +.simditor .simditor-body u, .editor-style u { + text-decoration: underline; +} +.simditor .simditor-body strike, .simditor .simditor-body del, .editor-style strike, .editor-style del { + text-decoration: line-through; +} +.simditor .simditor-body ul, .simditor .simditor-body ol, .editor-style ul, .editor-style ol { + list-style: disc outside none; + margin: 15px 0; + padding: 0 0 0 40px; + line-height: 1.6; +} +.simditor .simditor-body ul ul, .simditor .simditor-body ul ol, .simditor .simditor-body ol ul, .simditor .simditor-body ol ol, .editor-style ul ul, .editor-style ul ol, .editor-style ol ul, .editor-style ol ol { + padding-left: 30px; +} +.simditor .simditor-body ul ul, .simditor .simditor-body ol ul, .editor-style ul ul, .editor-style ol ul { + list-style: circle outside none; +} +.simditor .simditor-body ul ul ul, .simditor .simditor-body ol ul ul, .editor-style ul ul ul, .editor-style ol ul ul { + list-style: square outside none; +} +.simditor .simditor-body ol, .editor-style ol { + list-style: decimal; +} +.simditor .simditor-body blockquote, .editor-style blockquote { + border-left: 6px solid #ddd; + padding: 5px 0 5px 10px; + margin: 15px 0 15px 15px; +} +.simditor .simditor-body blockquote > :first-child, .editor-style blockquote > :first-child { + margin-top: 0; +} +.simditor .simditor-body code, .editor-style code { + display: inline-block; + padding: 0 4px; + margin: 0 5px; + background: #eeeeee; + border-radius: 3px; + font-size: 13px; + font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; +} +.simditor .simditor-body pre, .editor-style pre { + padding: 10px 5px 10px 10px; + margin: 15px 0; + display: block; + line-height: 18px; + background: #F0F0F0; + border-radius: 3px; + font-size: 13px; + font-family: 'monaco', 'Consolas', "Liberation Mono", Courier, monospace; + white-space: pre; + word-wrap: normal; + overflow-x: auto; +} +.simditor .simditor-body pre code, .editor-style pre code { + display: block; + padding: 0; + margin: 0; + background: none; + border-radius: 0; +} +.simditor .simditor-body hr, .editor-style hr { + display: block; + height: 0px; + border: 0; + border-top: 1px solid #ccc; + margin: 15px 0; + padding: 0; +} +.simditor .simditor-body table, .editor-style table { + width: 100%; + table-layout: fixed; + border-collapse: collapse; + border-spacing: 0; + margin: 15px 0; +} +.simditor .simditor-body table thead, .editor-style table thead { + background-color: #f9f9f9; +} +.simditor .simditor-body table td, .simditor .simditor-body table th, .editor-style table td, .editor-style table th { + min-width: 40px; + height: 30px; + border: 1px solid #ccc; + vertical-align: top; + padding: 2px 4px; + text-align: left; + box-sizing: border-box; +} +.simditor .simditor-body table td.active, .simditor .simditor-body table th.active, .editor-style table td.active, .editor-style table th.active { + background-color: #ffffee; +} +.simditor .simditor-body img, .editor-style img { + margin: 0 5px; + vertical-align: middle; +} diff --git a/public/js/hotkeys.js b/public/js/hotkeys.js new file mode 100644 index 000000000..de20b918c --- /dev/null +++ b/public/js/hotkeys.js @@ -0,0 +1,241 @@ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define('simple-hotkeys', ["jquery","simple-module"], function ($, SimpleModule) { + return (root['hotkeys'] = factory($, SimpleModule)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery"),require("simple-module")); + } else { + root.simple = root.simple || {}; + root.simple['hotkeys'] = factory(jQuery,SimpleModule); + } +}(this, function ($, SimpleModule) { + +var Hotkeys, hotkeys, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + +Hotkeys = (function(superClass) { + extend(Hotkeys, superClass); + + function Hotkeys() { + return Hotkeys.__super__.constructor.apply(this, arguments); + } + + Hotkeys.count = 0; + + Hotkeys.keyNameMap = { + 8: "Backspace", + 9: "Tab", + 13: "Enter", + 16: "Shift", + 17: "Control", + 18: "Alt", + 19: "Pause", + 20: "CapsLock", + 27: "Esc", + 32: "Spacebar", + 33: "PageUp", + 34: "PageDown", + 35: "End", + 36: "Home", + 37: "Left", + 38: "Up", + 39: "Right", + 40: "Down", + 45: "Insert", + 46: "Del", + 91: "Meta", + 93: "Meta", + 48: "0", + 49: "1", + 50: "2", + 51: "3", + 52: "4", + 53: "5", + 54: "6", + 55: "7", + 56: "8", + 57: "9", + 65: "A", + 66: "B", + 67: "C", + 68: "D", + 69: "E", + 70: "F", + 71: "G", + 72: "H", + 73: "I", + 74: "J", + 75: "K", + 76: "L", + 77: "M", + 78: "N", + 79: "O", + 80: "P", + 81: "Q", + 82: "R", + 83: "S", + 84: "T", + 85: "U", + 86: "V", + 87: "W", + 88: "X", + 89: "Y", + 90: "Z", + 96: "0", + 97: "1", + 98: "2", + 99: "3", + 100: "4", + 101: "5", + 102: "6", + 103: "7", + 104: "8", + 105: "9", + 106: "Multiply", + 107: "Add", + 109: "Subtract", + 110: "Decimal", + 111: "Divide", + 112: "F1", + 113: "F2", + 114: "F3", + 115: "F4", + 116: "F5", + 117: "F6", + 118: "F7", + 119: "F8", + 120: "F9", + 121: "F10", + 122: "F11", + 123: "F12", + 124: "F13", + 125: "F14", + 126: "F15", + 127: "F16", + 128: "F17", + 129: "F18", + 130: "F19", + 131: "F20", + 132: "F21", + 133: "F22", + 134: "F23", + 135: "F24", + 59: ";", + 61: "=", + 186: ";", + 187: "=", + 188: ",", + 190: ".", + 191: "/", + 192: "`", + 219: "[", + 220: "\\", + 221: "]", + 222: "'" + }; + + Hotkeys.aliases = { + "escape": "esc", + "delete": "del", + "return": "enter", + "ctrl": "control", + "space": "spacebar", + "ins": "insert", + "cmd": "meta", + "command": "meta", + "wins": "meta", + "windows": "meta" + }; + + Hotkeys.normalize = function(shortcut) { + var i, j, key, keyname, keys, len; + keys = shortcut.toLowerCase().replace(/\s+/gi, "").split("+"); + for (i = j = 0, len = keys.length; j < len; i = ++j) { + key = keys[i]; + keys[i] = this.aliases[key] || key; + } + keyname = keys.pop(); + keys.sort().push(keyname); + return keys.join("_"); + }; + + Hotkeys.prototype.opts = { + el: document + }; + + Hotkeys.prototype._init = function() { + this.id = ++this.constructor.count; + this._map = {}; + this._delegate = typeof this.opts.el === "string" ? document : this.opts.el; + return $(this._delegate).on("keydown.simple-hotkeys-" + this.id, this.opts.el, (function(_this) { + return function(e) { + var ref; + return (ref = _this._getHander(e)) != null ? ref.call(_this, e) : void 0; + }; + })(this)); + }; + + Hotkeys.prototype._getHander = function(e) { + var keyname, shortcut; + if (!(keyname = this.constructor.keyNameMap[e.which])) { + return; + } + shortcut = ""; + if (e.altKey) { + shortcut += "alt_"; + } + if (e.ctrlKey) { + shortcut += "control_"; + } + if (e.metaKey) { + shortcut += "meta_"; + } + if (e.shiftKey) { + shortcut += "shift_"; + } + shortcut += keyname.toLowerCase(); + return this._map[shortcut]; + }; + + Hotkeys.prototype.respondTo = function(subject) { + if (typeof subject === 'string') { + return this._map[this.constructor.normalize(subject)] != null; + } else { + return this._getHander(subject) != null; + } + }; + + Hotkeys.prototype.add = function(shortcut, handler) { + this._map[this.constructor.normalize(shortcut)] = handler; + return this; + }; + + Hotkeys.prototype.remove = function(shortcut) { + delete this._map[this.constructor.normalize(shortcut)]; + return this; + }; + + Hotkeys.prototype.destroy = function() { + $(this._delegate).off(".simple-hotkeys-" + this.id); + this._map = {}; + return this; + }; + + return Hotkeys; + +})(SimpleModule); + +hotkeys = function(opts) { + return new Hotkeys(opts); +}; + +return hotkeys; + +})); + diff --git a/public/js/module.js b/public/js/module.js new file mode 100644 index 000000000..9f7dbbd7c --- /dev/null +++ b/public/js/module.js @@ -0,0 +1,172 @@ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define('simple-module', ["jquery"], function (a0) { + return (root['Module'] = factory(a0)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery")); + } else { + root['SimpleModule'] = factory(jQuery); + } +}(this, function ($) { + +var Module, + slice = [].slice; + +Module = (function() { + Module.extend = function(obj) { + var key, ref, val; + if (!((obj != null) && typeof obj === 'object')) { + return; + } + for (key in obj) { + val = obj[key]; + if (key !== 'included' && key !== 'extended') { + this[key] = val; + } + } + return (ref = obj.extended) != null ? ref.call(this) : void 0; + }; + + Module.include = function(obj) { + var key, ref, val; + if (!((obj != null) && typeof obj === 'object')) { + return; + } + for (key in obj) { + val = obj[key]; + if (key !== 'included' && key !== 'extended') { + this.prototype[key] = val; + } + } + return (ref = obj.included) != null ? ref.call(this) : void 0; + }; + + Module.connect = function(cls) { + if (typeof cls !== 'function') { + return; + } + if (!cls.pluginName) { + throw new Error('Module.connect: cannot connect plugin without pluginName'); + return; + } + cls.prototype._connected = true; + if (!this._connectedClasses) { + this._connectedClasses = []; + } + this._connectedClasses.push(cls); + if (cls.pluginName) { + return this[cls.pluginName] = cls; + } + }; + + Module.prototype.opts = {}; + + function Module(opts) { + var base, cls, i, instance, instances, len, name; + this.opts = $.extend({}, this.opts, opts); + (base = this.constructor)._connectedClasses || (base._connectedClasses = []); + instances = (function() { + var i, len, ref, results; + ref = this.constructor._connectedClasses; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + cls = ref[i]; + name = cls.pluginName.charAt(0).toLowerCase() + cls.pluginName.slice(1); + if (cls.prototype._connected) { + cls.prototype._module = this; + } + results.push(this[name] = new cls()); + } + return results; + }).call(this); + if (this._connected) { + this.opts = $.extend({}, this.opts, this._module.opts); + } else { + this._init(); + for (i = 0, len = instances.length; i < len; i++) { + instance = instances[i]; + if (typeof instance._init === "function") { + instance._init(); + } + } + } + this.trigger('initialized'); + } + + Module.prototype._init = function() {}; + + Module.prototype.on = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + (ref = $(this)).on.apply(ref, args); + return this; + }; + + Module.prototype.one = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + (ref = $(this)).one.apply(ref, args); + return this; + }; + + Module.prototype.off = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + (ref = $(this)).off.apply(ref, args); + return this; + }; + + Module.prototype.trigger = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + (ref = $(this)).trigger.apply(ref, args); + return this; + }; + + Module.prototype.triggerHandler = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return (ref = $(this)).triggerHandler.apply(ref, args); + }; + + Module.prototype._t = function() { + var args, ref; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; + return (ref = this.constructor)._t.apply(ref, args); + }; + + Module._t = function() { + var args, key, ref, result; + key = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; + result = ((ref = this.i18n[this.locale]) != null ? ref[key] : void 0) || ''; + if (!(args.length > 0)) { + return result; + } + result = result.replace(/([^%]|^)%(?:(\d+)\$)?s/g, function(p0, p, position) { + if (position) { + return p + args[parseInt(position) - 1]; + } else { + return p + args.shift(); + } + }); + return result.replace(/%%s/g, '%s'); + }; + + Module.i18n = { + 'zh-CN': {} + }; + + Module.locale = 'zh-CN'; + + return Module; + +})(); + +return Module; + +})); diff --git a/public/js/simditor.js b/public/js/simditor.js new file mode 100644 index 000000000..056090fbb --- /dev/null +++ b/public/js/simditor.js @@ -0,0 +1,5585 @@ +/*! +* Simditor v2.3.6 +* http://simditor.tower.im/ +* 2015-12-21 +*/ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module unless amdModuleId is set + define('simditor', ["jquery","simple-module","simple-hotkeys","simple-uploader"], function ($, SimpleModule, simpleHotkeys, simpleUploader) { + return (root['Simditor'] = factory($, SimpleModule, simpleHotkeys, simpleUploader)); + }); + } else if (typeof exports === 'object') { + // Node. Does not work with strict CommonJS, but + // only CommonJS-like environments that support module.exports, + // like Node. + module.exports = factory(require("jquery"),require("simple-module"),require("simple-hotkeys"),require("simple-uploader")); + } else { + root['Simditor'] = factory(jQuery,SimpleModule,simple.hotkeys,simple.uploader); + } +}(this, function ($, SimpleModule, simpleHotkeys, simpleUploader) { + +var AlignmentButton, BlockquoteButton, BoldButton, Button, Clipboard, CodeButton, CodePopover, ColorButton, FontScaleButton, Formatter, HrButton, ImageButton, ImagePopover, IndentButton, Indentation, InputManager, ItalicButton, Keystroke, LinkButton, LinkPopover, ListButton, OrderListButton, OutdentButton, Popover, Selection, Simditor, StrikethroughButton, TableButton, TitleButton, Toolbar, UnderlineButton, UndoManager, UnorderListButton, Util, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + slice = [].slice; + +Selection = (function(superClass) { + extend(Selection, superClass); + + function Selection() { + return Selection.__super__.constructor.apply(this, arguments); + } + + Selection.pluginName = 'Selection'; + + Selection.prototype._range = null; + + Selection.prototype._startNodes = null; + + Selection.prototype._endNodes = null; + + Selection.prototype._containerNode = null; + + Selection.prototype._nodes = null; + + Selection.prototype._blockNodes = null; + + Selection.prototype._rootNodes = null; + + Selection.prototype._init = function() { + this.editor = this._module; + this._selection = document.getSelection(); + this.editor.on('selectionchanged', (function(_this) { + return function(e) { + _this.reset(); + return _this._range = _this._selection.getRangeAt(0); + }; + })(this)); + return this.editor.on('blur', (function(_this) { + return function(e) { + return _this.reset(); + }; + })(this)); + }; + + Selection.prototype.reset = function() { + this._range = null; + this._startNodes = null; + this._endNodes = null; + this._containerNode = null; + this._nodes = null; + this._blockNodes = null; + return this._rootNodes = null; + }; + + Selection.prototype.clear = function() { + var e; + try { + this._selection.removeAllRanges(); + } catch (_error) { + e = _error; + } + return this.reset(); + }; + + Selection.prototype.range = function(range) { + var ffOrIE; + if (range) { + this.clear(); + this._selection.addRange(range); + this._range = range; + ffOrIE = this.editor.util.browser.firefox || this.editor.util.browser.msie; + if (!this.editor.inputManager.focused && ffOrIE) { + this.editor.body.focus(); + } + } else if (!this._range && this.editor.inputManager.focused && this._selection.rangeCount) { + this._range = this._selection.getRangeAt(0); + } + return this._range; + }; + + Selection.prototype.startNodes = function() { + if (this._range) { + this._startNodes || (this._startNodes = (function(_this) { + return function() { + var startNodes; + startNodes = $(_this._range.startContainer).parentsUntil(_this.editor.body).get(); + startNodes.unshift(_this._range.startContainer); + return $(startNodes); + }; + })(this)()); + } + return this._startNodes; + }; + + Selection.prototype.endNodes = function() { + var endNodes; + if (this._range) { + this._endNodes || (this._endNodes = this._range.collapsed ? this.startNodes() : (endNodes = $(this._range.endContainer).parentsUntil(this.editor.body).get(), endNodes.unshift(this._range.endContainer), $(endNodes))); + } + return this._endNodes; + }; + + Selection.prototype.containerNode = function() { + if (this._range) { + this._containerNode || (this._containerNode = $(this._range.commonAncestorContainer)); + } + return this._containerNode; + }; + + Selection.prototype.nodes = function() { + if (this._range) { + this._nodes || (this._nodes = (function(_this) { + return function() { + var nodes; + nodes = []; + if (_this.startNodes().first().is(_this.endNodes().first())) { + nodes = _this.startNodes().get(); + } else { + _this.startNodes().each(function(i, node) { + var $endNode, $node, $nodes, endIndex, index, sharedIndex, startIndex; + $node = $(node); + if (_this.endNodes().index($node) > -1) { + return nodes.push(node); + } else if ($node.parent().is(_this.editor.body) || (sharedIndex = _this.endNodes().index($node.parent())) > -1) { + if (sharedIndex && sharedIndex > -1) { + $endNode = _this.endNodes().eq(sharedIndex - 1); + } else { + $endNode = _this.endNodes().last(); + } + $nodes = $node.parent().contents(); + startIndex = $nodes.index($node); + endIndex = $nodes.index($endNode); + return $.merge(nodes, $nodes.slice(startIndex, endIndex).get()); + } else { + $nodes = $node.parent().contents(); + index = $nodes.index($node); + return $.merge(nodes, $nodes.slice(index).get()); + } + }); + _this.endNodes().each(function(i, node) { + var $node, $nodes, index; + $node = $(node); + if ($node.parent().is(_this.editor.body) || _this.startNodes().index($node.parent()) > -1) { + nodes.push(node); + return false; + } else { + $nodes = $node.parent().contents(); + index = $nodes.index($node); + return $.merge(nodes, $nodes.slice(0, index + 1)); + } + }); + } + return $($.unique(nodes)); + }; + })(this)()); + } + return this._nodes; + }; + + Selection.prototype.blockNodes = function() { + if (!this._range) { + return; + } + this._blockNodes || (this._blockNodes = (function(_this) { + return function() { + return _this.nodes().filter(function(i, node) { + return _this.editor.util.isBlockNode(node); + }); + }; + })(this)()); + return this._blockNodes; + }; + + Selection.prototype.rootNodes = function() { + if (!this._range) { + return; + } + this._rootNodes || (this._rootNodes = (function(_this) { + return function() { + return _this.nodes().filter(function(i, node) { + var $parent; + $parent = $(node).parent(); + return $parent.is(_this.editor.body) || $parent.is('blockquote'); + }); + }; + })(this)()); + return this._rootNodes; + }; + + Selection.prototype.rangeAtEndOf = function(node, range) { + var afterLastNode, beforeLastNode, endNode, endNodeLength, lastNodeIsBr, result; + if (range == null) { + range = this.range(); + } + if (!(range && range.collapsed)) { + return; + } + node = $(node)[0]; + endNode = range.endContainer; + endNodeLength = this.editor.util.getNodeLength(endNode); + beforeLastNode = range.endOffset === endNodeLength - 1; + lastNodeIsBr = $(endNode).contents().last().is('br'); + afterLastNode = range.endOffset === endNodeLength; + if (!((beforeLastNode && lastNodeIsBr) || afterLastNode)) { + return false; + } + if (node === endNode) { + return true; + } else if (!$.contains(node, endNode)) { + return false; + } + result = true; + $(endNode).parentsUntil(node).addBack().each(function(i, n) { + var $lastChild, beforeLastbr, isLastNode, nodes; + nodes = $(n).parent().contents().filter(function() { + return !(this !== n && this.nodeType === 3 && !this.nodeValue); + }); + $lastChild = nodes.last(); + isLastNode = $lastChild.get(0) === n; + beforeLastbr = $lastChild.is('br') && $lastChild.prev().get(0) === n; + if (!(isLastNode || beforeLastbr)) { + result = false; + return false; + } + }); + return result; + }; + + Selection.prototype.rangeAtStartOf = function(node, range) { + var result, startNode; + if (range == null) { + range = this.range(); + } + if (!(range && range.collapsed)) { + return; + } + node = $(node)[0]; + startNode = range.startContainer; + if (range.startOffset !== 0) { + return false; + } + if (node === startNode) { + return true; + } else if (!$.contains(node, startNode)) { + return false; + } + result = true; + $(startNode).parentsUntil(node).addBack().each(function(i, n) { + var nodes; + nodes = $(n).parent().contents().filter(function() { + return !(this !== n && this.nodeType === 3 && !this.nodeValue); + }); + if (nodes.first().get(0) !== n) { + return result = false; + } + }); + return result; + }; + + Selection.prototype.insertNode = function(node, range) { + if (range == null) { + range = this.range(); + } + if (!range) { + return; + } + node = $(node)[0]; + range.insertNode(node); + return this.setRangeAfter(node, range); + }; + + Selection.prototype.setRangeAfter = function(node, range) { + if (range == null) { + range = this.range(); + } + if (range == null) { + return; + } + node = $(node)[0]; + range.setEndAfter(node); + range.collapse(false); + return this.range(range); + }; + + Selection.prototype.setRangeBefore = function(node, range) { + if (range == null) { + range = this.range(); + } + if (range == null) { + return; + } + node = $(node)[0]; + range.setEndBefore(node); + range.collapse(false); + return this.range(range); + }; + + Selection.prototype.setRangeAtStartOf = function(node, range) { + if (range == null) { + range = this.range(); + } + node = $(node).get(0); + range.setEnd(node, 0); + range.collapse(false); + return this.range(range); + }; + + Selection.prototype.setRangeAtEndOf = function(node, range) { + var $lastNode, $node, contents, lastChild, lastChildLength, lastText, nodeLength; + if (range == null) { + range = this.range(); + } + $node = $(node); + node = $node[0]; + if ($node.is('pre')) { + contents = $node.contents(); + if (contents.length > 0) { + lastChild = contents.last(); + lastText = lastChild.text(); + lastChildLength = this.editor.util.getNodeLength(lastChild[0]); + if (lastText.charAt(lastText.length - 1) === '\n') { + range.setEnd(lastChild[0], lastChildLength - 1); + } else { + range.setEnd(lastChild[0], lastChildLength); + } + } else { + range.setEnd(node, 0); + } + } else { + nodeLength = this.editor.util.getNodeLength(node); + if (node.nodeType !== 3 && nodeLength > 0) { + $lastNode = $(node).contents().last(); + if ($lastNode.is('br')) { + nodeLength -= 1; + } else if ($lastNode[0].nodeType !== 3 && this.editor.util.isEmptyNode($lastNode)) { + $lastNode.append(this.editor.util.phBr); + node = $lastNode[0]; + nodeLength = 0; + } + } + range.setEnd(node, nodeLength); + } + range.collapse(false); + return this.range(range); + }; + + Selection.prototype.deleteRangeContents = function(range) { + var atEndOfBody, atStartOfBody, endRange, startRange; + if (range == null) { + range = this.range(); + } + startRange = range.cloneRange(); + endRange = range.cloneRange(); + startRange.collapse(true); + endRange.collapse(false); + atStartOfBody = this.rangeAtStartOf(this.editor.body, startRange); + atEndOfBody = this.rangeAtEndOf(this.editor.body, endRange); + if (!range.collapsed && atStartOfBody && atEndOfBody) { + this.editor.body.empty(); + range.setStart(this.editor.body[0], 0); + range.collapse(true); + this.range(range); + } else { + range.deleteContents(); + } + return range; + }; + + Selection.prototype.breakBlockEl = function(el, range) { + var $el; + if (range == null) { + range = this.range(); + } + $el = $(el); + if (!range.collapsed) { + return $el; + } + range.setStartBefore($el.get(0)); + if (range.collapsed) { + return $el; + } + return $el.before(range.extractContents()); + }; + + Selection.prototype.save = function(range) { + var endCaret, endRange, startCaret; + if (range == null) { + range = this.range(); + } + if (this._selectionSaved) { + return; + } + endRange = range.cloneRange(); + endRange.collapse(false); + startCaret = $('').addClass('simditor-caret-start'); + endCaret = $('').addClass('simditor-caret-end'); + endRange.insertNode(endCaret[0]); + range.insertNode(startCaret[0]); + this.clear(); + return this._selectionSaved = true; + }; + + Selection.prototype.restore = function() { + var endCaret, endContainer, endOffset, range, startCaret, startContainer, startOffset; + if (!this._selectionSaved) { + return false; + } + startCaret = this.editor.body.find('.simditor-caret-start'); + endCaret = this.editor.body.find('.simditor-caret-end'); + if (startCaret.length && endCaret.length) { + startContainer = startCaret.parent(); + startOffset = startContainer.contents().index(startCaret); + endContainer = endCaret.parent(); + endOffset = endContainer.contents().index(endCaret); + if (startContainer[0] === endContainer[0]) { + endOffset -= 1; + } + range = document.createRange(); + range.setStart(startContainer.get(0), startOffset); + range.setEnd(endContainer.get(0), endOffset); + startCaret.remove(); + endCaret.remove(); + this.range(range); + } else { + startCaret.remove(); + endCaret.remove(); + } + this._selectionSaved = false; + return range; + }; + + return Selection; + +})(SimpleModule); + +Formatter = (function(superClass) { + extend(Formatter, superClass); + + function Formatter() { + return Formatter.__super__.constructor.apply(this, arguments); + } + + Formatter.pluginName = 'Formatter'; + + Formatter.prototype.opts = { + allowedTags: [], + allowedAttributes: {}, + allowedStyles: {} + }; + + Formatter.prototype._init = function() { + this.editor = this._module; + this._allowedTags = $.merge(['br', 'span', 'a', 'img', 'b', 'strong', 'i', 'strike', 'u', 'font', 'p', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'h1', 'h2', 'h3', 'h4', 'hr'], this.opts.allowedTags); + this._allowedAttributes = $.extend({ + img: ['src', 'alt', 'width', 'height', 'data-non-image'], + a: ['href', 'target'], + font: ['color'], + code: ['class'] + }, this.opts.allowedAttributes); + this._allowedStyles = $.extend({ + span: ['color', 'font-size'], + b: ['color'], + i: ['color'], + strong: ['color'], + strike: ['color'], + u: ['color'], + p: ['margin-left', 'text-align'], + h1: ['margin-left', 'text-align'], + h2: ['margin-left', 'text-align'], + h3: ['margin-left', 'text-align'], + h4: ['margin-left', 'text-align'] + }, this.opts.allowedStyles); + return this.editor.body.on('click', 'a', function(e) { + return false; + }); + }; + + Formatter.prototype.decorate = function($el) { + if ($el == null) { + $el = this.editor.body; + } + this.editor.trigger('decorate', [$el]); + return $el; + }; + + Formatter.prototype.undecorate = function($el) { + if ($el == null) { + $el = this.editor.body.clone(); + } + this.editor.trigger('undecorate', [$el]); + return $el; + }; + + Formatter.prototype.autolink = function($el) { + var $link, $node, findLinkNode, k, lastIndex, len, linkNodes, match, re, replaceEls, subStr, text, uri; + if ($el == null) { + $el = this.editor.body; + } + linkNodes = []; + findLinkNode = function($parentNode) { + return $parentNode.contents().each(function(i, node) { + var $node, text; + $node = $(node); + if ($node.is('a') || $node.closest('a, pre', $el).length) { + return; + } + if (!$node.is('iframe') && $node.contents().length) { + return findLinkNode($node); + } else if ((text = $node.text()) && /https?:\/\/|www\./ig.test(text)) { + return linkNodes.push($node); + } + }); + }; + findLinkNode($el); + re = /(https?:\/\/|www\.)[\w\-\.\?&=\/#%:,@\!\+]+/ig; + for (k = 0, len = linkNodes.length; k < len; k++) { + $node = linkNodes[k]; + text = $node.text(); + replaceEls = []; + match = null; + lastIndex = 0; + while ((match = re.exec(text)) !== null) { + subStr = text.substring(lastIndex, match.index); + replaceEls.push(document.createTextNode(subStr)); + lastIndex = re.lastIndex; + uri = /^(http(s)?:\/\/|\/)/.test(match[0]) ? match[0] : 'http://' + match[0]; + $link = $("").text(match[0]); + replaceEls.push($link[0]); + } + replaceEls.push(document.createTextNode(text.substring(lastIndex))); + $node.replaceWith($(replaceEls)); + } + return $el; + }; + + Formatter.prototype.format = function($el) { + var $node, blockNode, k, l, len, len1, n, node, ref, ref1; + if ($el == null) { + $el = this.editor.body; + } + if ($el.is(':empty')) { + $el.append('

' + this.editor.util.phBr + '

'); + return $el; + } + ref = $el.contents(); + for (k = 0, len = ref.length; k < len; k++) { + n = ref[k]; + this.cleanNode(n, true); + } + ref1 = $el.contents(); + for (l = 0, len1 = ref1.length; l < len1; l++) { + node = ref1[l]; + $node = $(node); + if ($node.is('br')) { + if (typeof blockNode !== "undefined" && blockNode !== null) { + blockNode = null; + } + $node.remove(); + } else if (this.editor.util.isBlockNode(node)) { + if ($node.is('li')) { + if (blockNode && blockNode.is('ul, ol')) { + blockNode.append(node); + } else { + blockNode = $('