From 1c9f303e759535fa26d213e72809e7de11c40a33 Mon Sep 17 00:00:00 2001 From: Matthew Borden Date: Tue, 9 Dec 2014 21:50:27 +0100 Subject: [PATCH] Update Squire & Implement Headings in Squire-UI --- build/Squire-UI.css | 23 +- build/Squire-UI.js | 9 +- build/document.html | 5 +- build/font-awesome/font-awesome.min.css | 20 +- build/ie8.js | 1 - build/squire-raw.js | 568 +++++++++++------------- build/squire.js | 4 +- 7 files changed, 318 insertions(+), 312 deletions(-) delete mode 100644 build/ie8.js diff --git a/build/Squire-UI.css b/build/Squire-UI.css index f9518a7..fd774fc 100644 --- a/build/Squire-UI.css +++ b/build/Squire-UI.css @@ -144,8 +144,7 @@ input[type=text] { right:0; margin-bottom: 5px; } - - .drop-element, .drop-element:after, .drop-element:before, .drop-element *, .drop-element *:after, .drop-element *:before { +.drop-element, .drop-element:after, .drop-element:before, .drop-element *, .drop-element *:after, .drop-element *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } @@ -268,4 +267,22 @@ input[type=text] { /*! * Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('./font-awesome/fontawesome-webfont.eot?v=4.1.0');src:url('./font-awesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('./font-awesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('./font-awesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('./font-awesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-square:before,.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"} \ No newline at end of file + */@font-face{font-family:'FontAwesome';src:url('./font-awesome/fontawesome-webfont.eot?v=4.1.0');src:url('./font-awesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('./font-awesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('./font-awesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('./font-awesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal} + .fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} + .fa-bold:before{content:"\f032"} + .fa-italic:before{content:"\f033"} + .fa-underline:before{content:"\f0cd"} + .fa-font:before{content:"\f031"} + .fa-link:before{content:"\f0c1"} + .fa-list-alt:before{content:"\f022"} + .fa-list:before{content:"\f03a"} + .fa-picture-o:before{content:"\f03e"} + .fa-quote-right:before{content:"\f10e"} + .fa-chevron-up:before{content:"\f077"} + .fa-header:before{content:"\f1dc"} +.fa-align-left:before{content:"\f036"} +.fa-align-center:before{content:"\f037"} +.fa-align-right:before{content:"\f038"} +.fa-align-justify:before{content:"\f039"} +.fa-undo:before{content:"\f0e2"} +.fa-heart:before{content:"\f004"} \ No newline at end of file diff --git a/build/Squire-UI.js b/build/Squire-UI.js index 2b7b7bd..226e399 100644 --- a/build/Squire-UI.js +++ b/build/Squire-UI.js @@ -124,6 +124,7 @@ $(document).ready(function() { testQuote: editor.testPresenceinSelection( 'increaseQuoteLevel', action, 'blockquote', ( />blockquote\b/)), + testHeading: editor.testPresenceinSelection('makeHeading', action, 'H1', (/>H1\b/)), isNotValue: function (a) {return (a == action && this.value !== ''); } }; @@ -131,20 +132,20 @@ $(document).ready(function() { editor.alignCenter = function () { editor.setTextAlignment('center'); }; editor.alignLeft = function () { editor.setTextAlignment('left'); }; editor.alignJustify = function () { editor.setTextAlignment('justify'); }; - editor.makeHeading = function () { editor.setFontSize('2em'); editor.bold(); }; - if (test.testBold | test.testItalic | test.testUnderline | test.testOrderedList | test.testLink | test.testQuote) { + if (test.testBold | test.testItalic | test.testUnderline | test.testOrderedList | test.testLink | test.testQuote | test.testHeading) { if (test.testBold) editor.removeBold(); if (test.testItalic) editor.removeItalic(); if (test.testUnderline) editor.removeUnderline(); if (test.testLink) editor.removeLink(); if (test.testOrderedList) editor.removeList(); if (test.testQuote) editor.decreaseQuoteLevel(); + if (test.testHeading) editor.removeHeading(); } else if (test.isNotValue('makeLink') | test.isNotValue('insertImage') | test.isNotValue('selectFont')) { // do nothing these are dropdowns. } else { - if (editor.getSelectedText() === '' && !(action == 'insertImage' || action == 'makeOrderedList' || action == 'increaseQuoteLevel' || action == 'redo' || action == 'undo')) return; - editor[action](); + if (editor.getSelectedText() === '' && !(action == 'insertImage' || action == 'makeOrderedList' || action == 'increaseQuoteLevel' || action == 'redo' || action == 'undo' || action == "makeHeading")) return; + editor[action](); } }); }); diff --git a/build/document.html b/build/document.html index 428e909..cc73699 100644 --- a/build/document.html +++ b/build/document.html @@ -49,9 +49,6 @@ - - \ No newline at end of file + diff --git a/build/font-awesome/font-awesome.min.css b/build/font-awesome/font-awesome.min.css index 82f960d..cf61c73 100755 --- a/build/font-awesome/font-awesome.min.css +++ b/build/font-awesome/font-awesome.min.css @@ -1,4 +1,22 @@ /*! * Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('./font-awesome/fontawesome-webfont.eot?v=4.1.0');src:url('./font-awesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('./font-awesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('./font-awesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('./font-awesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:spin 2s infinite linear;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;animation:spin 2s infinite linear}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-moz-transform:scale(-1, 1);-ms-transform:scale(-1, 1);-o-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-moz-transform:scale(1, -1);-ms-transform:scale(1, -1);-o-transform:scale(1, -1);transform:scale(1, -1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-square:before,.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"} \ No newline at end of file + */@font-face{font-family:'FontAwesome';src:url('./font-awesome/fontawesome-webfont.eot?v=4.1.0');src:url('./font-awesome/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'),url('./font-awesome/fontawesome-webfont.woff?v=4.1.0') format('woff'),url('./font-awesome/fontawesome-webfont.ttf?v=4.1.0') format('truetype'),url('./font-awesome/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal} + .fa{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} + .fa-bold:before{content:"\f032"} + .fa-italic:before{content:"\f033"} + .fa-underline:before{content:"\f0cd"} + .fa-font:before{content:"\f031"} + .fa-link:before{content:"\f0c1"} + .fa-list-alt:before{content:"\f022"} + .fa-list:before{content:"\f03a"} + .fa-picture-o:before{content:"\f03e"} + .fa-quote-right:before{content:"\f10e"} + .fa-chevron-up:before{content:"\f077"} + .fa-header:before{content:"\f1dc"} +.fa-align-left:before{content:"\f036"} +.fa-align-center:before{content:"\f037"} +.fa-align-right:before{content:"\f038"} +.fa-align-justify:before{content:"\f039"} +.fa-undo:before{content:"\f0e2"} +.fa-heart:before{content:"\f004"} \ No newline at end of file diff --git a/build/ie8.js b/build/ie8.js deleted file mode 100644 index 41efb73..0000000 --- a/build/ie8.js +++ /dev/null @@ -1 +0,0 @@ -!function(){Array.prototype.indexOf=function(t,e){for(var n=this.length,r=0>e?Math.max(0,n+e):e||0;n>r;r+=1)if(this[r]===t)return r;return-1},Array.prototype.forEach=function(t,e){var n=this.length>>>0;if("function"!=typeof t)throw new TypeError;for(var r=0;n>r;r+=1)t.call(e,this[r],r,this)},Array.prototype.filter=function(t,e){for(var n=[],r=0,o=this.length;o>r;r+=1){var i=this[r];t.call(e,i,r,this)&&n.push(i)}return n},Object.keyOf=function(t,e){for(var n in t)if(t[n]===e)return n},Date.now=function(){return+new Date},String.prototype.trim=function(){for(var t=this.replace(/^\s\s*/,""),e=/\s/,n=t.length;e.test(t.charAt(n-=1)););return t.slice(0,n+1)}}(),function(){var t=document;window.ie=8,t.defaultView=window;var e={focus:"focusin",blur:"focusout"},n=function(){return!0},r=function(){return!1},o="altKey ctrlKey metaKey shiftKey clientX clientY charCode keyCode".split(" "),i=function(t){for(var n,r=t.type,i=document,a=t.srcElement||i,s=(a.ownerDocument||i).documentElement,c=o.length;c--;)n=o[c],this[n]=t[n];"propertychange"===r&&(r="INPUT"===a.nodeName&&"text"!==a.type&&"password"!==a.type?"change":"input"),this.type=Object.keyOf(e,r)||r,this.target=a,this.pageX=t.clientX+s.scrollLeft,this.pageY=t.clientY+s.scrollTop,t.button&&(this.button=4&t.button?1:2&t.button?2:0,this.which=this.button+1),this.relatedTarget=t.fromElement===a?t.toElement:t.fromElement,this._event=t};i.prototype={constructor:i,isEvent:!0,preventDefault:function(){this.isDefaultPrevented=n,this._event.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=n,this._event.cancelBubble=!0},isDefaultPrevented:r,isPropagationStopped:r},[t,Element.prototype].forEach(function(t){t.addEventListener=function(t,n){var r=n._ie_handleEvent||(n._ie_handleEvent=function(){var t=new i(window.event);"object"==typeof n?n.handleEvent(t):n.call(this,t)}),o=/paste|cut/.test(t)?this.body||this:this;n._ie_registeredCount=(n._ie_registeredCount||0)+1,o.attachEvent("on"+(e[t]||t),r)},t.addEventListener.isFake=!0,t.removeEventListener=function(t,n){var r=n._ie_handleEvent,o=/paste|cut/.test(t)?this.body||this:this;(n._ie_registeredCount-=1)||delete n._ie_handleEvent,r&&o.detachEvent("on"+(e[t]||t),r)},t.removeEventListener.isFake=!0}),t.defaultView.addEventListener=function(e,n,r){return t.addEventListener(e,n,r)},Object.defineProperty(Element.prototype,"textContent",{get:function(){return this.innerText},set:function(t){this.innerText=t}}),Element.prototype.compareDocumentPosition=function(t){1!==t.nodeType&&(t=t.parentNode);var e=this,n=e!==t,r=e.sourceIndex,o=t.sourceIndex;return(n&&e.contains(t)?16:0)+(n&&t.contains(e)?8:0)+(o>r?4:0)+(r>o?2:0)},HTMLDocument.prototype.normalize=function(){for(var t,e=this.childNodes,n=e.length;n--;)t=e[n],1===t.nodeType&&t.normalize()}}();var Range;!function(){var t=Array.prototype.indexOf,e=0,n=1,r=3,o=function(t,e){for(;e=e.parentNode;)if(t===e)return!0;return!1},i=function(t,e){var n,r,i,a,s;if(t===e||o(t,e))n=t;else if(o(e,t))n=e;else{for(r=[],i=[];t=t.parentNode;)r.push(t);for(;e=e.parentNode;)i.push(e);for(a=r.length,s=i.length;a--&&s--;)if(r[a]!==i[s]){n=r[a+1];break}n||(n=-1===a?r[0]:i[0])}return n};Range=function(t,e,n,r){t=t||document,e=e||0,this.startContainer=t,this.startOffset=e,this.endContainer=n||t,this.endOffset=void 0!==r?r:e,this._updateCollapsedAndAncestor()},Range.prototype={constructor:Range,_updateCollapsedAndAncestor:function(){this.collapsed=this.startContainer===this.endContainer&&this.startOffset===this.endOffset,this.commonAncestorContainer=i(this.startContainer,this.endContainer)},setStart:function(t,e){this.startContainer=t,this.startOffset=e,this._updateCollapsedAndAncestor()},setEnd:function(t,e){this.endContainer=t,this.endOffset=e,this._updateCollapsedAndAncestor()},setStartAfter:function(e){var n=e.parentNode;this.setStart(n,t.call(n.childNodes,e)+1)},setEndBefore:function(e){var n=e.parentNode;this.setEnd(n,t.call(n.childNodes,e))},selectNode:function(e){var n=e.parentNode,r=t.call(n.childNodes,e);this.setStart(n,r),this.setEnd(n,r+1)},selectNodeContents:function(t){this.setStart(t,0),this.setEnd(t,t.childNodes.length)},cloneRange:function(){return new Range(this.startContainer,this.startOffset,this.endContainer,this.endOffset)},collapse:function(t){t?this.setEnd(this.startContainer,this.startOffset):this.setStart(this.endContainer,this.endOffset)},compareBoundaryPoints:function(o,i){var a,s,c,d,f,u;if(o===e||o===r?(a=this.startContainer,s=this.startOffset):(a=this.endContainer,s=this.endOffset),o===e||o===n?(c=i.startContainer,d=i.startOffset):(c=i.endContainer,d=i.endOffset),a===c)return d>s?-1:s>d?1:0;for(f=a;u=f.parentNode;){if(u===c)return t.call(u.childNodes,f)c.sourceIndex?1:0}},document.createRange=function(){return new Range};var a=function(t,e){return t===e||o(t,e)},s=function(t){var e=t.nodeType;return 3===e||4===e||8===e},c=function(t,e){this.node=t,this.offset=e},d=function(t){var e,n,r,o,a=t.parentElement();return e=t.duplicate(),e.collapse(!0),n=e.parentElement(),e=t.duplicate(),e.collapse(!1),r=e.parentElement(),o=n===r?n:i(n,r),o===a?o:i(a,o)},f=function(e,n,r,o){var i=e.duplicate();i.collapse(r);var d=i.parentElement();if(a(n,d)||(d=n),!d.canHaveHTML)return new c(d.parentNode,t.call(d.parentNode.childNodes,d));var f,u,l,h,p,v=document.createElement("span"),m=r?"StartToStart":"StartToEnd";do d.insertBefore(v,v.previousSibling),i.moveToElementText(v),f=i.compareEndPoints(m,e);while(f>0&&v.previousSibling);if(p=v.nextSibling,-1===f&&p&&s(p)){i.setEndPoint(r?"EndToStart":"EndToEnd",e);var E;if(/[\r\n]/.test(p.data)||/[\r\n]/.test(i.text)){var g=i.duplicate(),y=g.text.replace(/\r\n/g,"\r").length;for(E=g.moveStart("character",y);-1===(f=g.compareEndPoints("StartToEnd",g));)E+=1,g.moveStart("character",1)}else E=i.text.length;h=new c(p,E)}else u=(o||!r)&&v.previousSibling,l=(o||r)&&v.nextSibling,h=l&&s(l)?new c(l,0):u&&s(u)?new c(u,u.data.length):new c(d,t.call(d.childNodes,v));return v.parentNode.removeChild(v),h},u=function(t,e){var n,r,o,i,a=t.offset,c=document,d=c.body.createTextRange(),f=s(t.node);return f?(n=t.node,r=n.parentNode):(i=t.node.childNodes,n=a must be @@ -297,7 +298,8 @@ function fixCursor ( node ) { // cursor to appear. var doc = node.ownerDocument, root = node, - fixer, child; + fixer, child, + l, instance; if ( node.nodeName === 'BODY' ) { if ( !( child = node.firstChild ) || child.nodeName === 'BR' ) { @@ -314,11 +316,22 @@ function fixCursor ( node ) { } if ( isInline( node ) ) { - if ( !node.firstChild ) { + child = node.firstChild; + while ( cantFocusEmptyTextNodes && child && + child.nodeType === TEXT_NODE && !child.data ) { + node.removeChild( child ); + child = node.firstChild; + } + if ( !child ) { if ( cantFocusEmptyTextNodes ) { fixer = doc.createTextNode( '\u200B' ); - if ( win.editor ) { - win.editor._didAddZWS(); + // Find the relevant Squire instance and notify + l = instances.length; + while ( l-- ) { + instance = instances[l]; + if ( instance._doc === doc ) { + instance._didAddZWS(); + } } } else { fixer = doc.createTextNode( '' ); @@ -358,6 +371,42 @@ function fixCursor ( node ) { return root; } +// Recursively examine container nodes and wrap any inline children. +function fixContainer ( container ) { + var children = container.childNodes, + doc = container.ownerDocument, + wrapper = null, + i, l, child, isBR; + for ( i = 0, l = children.length; i < l; i += 1 ) { + child = children[i]; + isBR = child.nodeName === 'BR'; + if ( !isBR && isInline( child ) ) { + if ( !wrapper ) { wrapper = createElement( doc, 'DIV' ); } + wrapper.appendChild( child ); + i -= 1; + l -= 1; + } else if ( isBR || wrapper ) { + if ( !wrapper ) { wrapper = createElement( doc, 'DIV' ); } + fixCursor( wrapper ); + if ( isBR ) { + container.replaceChild( wrapper, child ); + } else { + container.insertBefore( wrapper, child ); + i += 1; + l += 1; + } + wrapper = null; + } + if ( isContainer( child ) ) { + fixContainer( child ); + } + } + if ( wrapper ) { + container.appendChild( fixCursor( wrapper ) ); + } + return container; +} + function split ( node, offset, stopNode ) { var nodeType = node.nodeType, parent, clone, next; @@ -499,7 +548,7 @@ function mergeWithBlock ( block, next, range ) { // Steps to reproduce bug: Type "a-b-c" (where - is return) // then backspace twice. The cursor goes to the top instead // of after "b". - if ( isOpera && ( last = block.lastChild ) && last.nodeName === 'BR' ) { + if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) { block.removeChild( last ); } } @@ -541,90 +590,7 @@ function mergeContainers ( node ) { fixCursor( prev ); } } - -// Recursively examine container nodes and wrap any inline children. -function fixContainer ( container ) { - var children = container.childNodes, - doc = container.ownerDocument, - wrapper = null, - i, l, child, isBR; - for ( i = 0, l = children.length; i < l; i += 1 ) { - child = children[i]; - isBR = child.nodeName === 'BR'; - if ( !isBR && isInline( child ) ) { - if ( !wrapper ) { wrapper = createElement( doc, 'DIV' ); } - wrapper.appendChild( child ); - i -= 1; - l -= 1; - } else if ( isBR || wrapper ) { - if ( !wrapper ) { wrapper = createElement( doc, 'DIV' ); } - fixCursor( wrapper ); - if ( isBR ) { - container.replaceChild( wrapper, child ); - } else { - container.insertBefore( wrapper, child ); - i += 1; - l += 1; - } - wrapper = null; - } - if ( isContainer( child ) ) { - fixContainer( child ); - } - } - if ( wrapper ) { - container.appendChild( fixCursor( wrapper ) ); - } - return container; -} - -function createElement ( doc, tag, props, children ) { - var el = doc.createElement( tag ), - attr, value, i, l; - if ( props instanceof Array ) { - children = props; - props = null; - } - if ( props ) { - for ( attr in props ) { - value = props[ attr ]; - if ( value !== undefined ) { - el.setAttribute( attr, props[ attr ] ); - } - } - } - if ( children ) { - for ( i = 0, l = children.length; i < l; i += 1 ) { - el.appendChild( children[i] ); - } - } - return el; -} -/*global - ELEMENT_NODE, - TEXT_NODE, - SHOW_TEXT, - FILTER_ACCEPT, - START_TO_START, - START_TO_END, - END_TO_END, - END_TO_START, - indexOf, - - TreeWalker, - - isLeaf, - isInline, - isBlock, - getPreviousBlock, - getNextBlock, - getLength, - fixCursor, - split, - mergeWithBlock, - mergeContainers -*/ -/*jshint strict:false */ +/*jshint strict:false, undef:false, unused:false */ var getNodeBefore = function ( node, offset ) { var children = node.childNodes; @@ -661,8 +627,8 @@ var forEachTextNodeInRange = function ( range, fn ) { endContainer = range.endContainer, root = range.commonAncestorContainer, walker = new TreeWalker( - root, SHOW_TEXT, function ( node ) { - return FILTER_ACCEPT; + root, SHOW_TEXT, function (/* node */) { + return true; }, false ), textnode = walker.currentNode = startContainer; @@ -1053,50 +1019,56 @@ var getEndBlockOfRange = function ( range ) { return block && isNodeContainedInRange( range, block, true ) ? block : null; }; +var contentWalker = new TreeWalker( null, + SHOW_TEXT|SHOW_ELEMENT, + function ( node ) { + return node.nodeType === TEXT_NODE ? + notWS.test( node.data ) : + node.nodeName === 'IMG'; + } +); + var rangeDoesStartAtBlockBoundary = function ( range ) { var startContainer = range.startContainer, - startOffset = range.startOffset, - parent, child; + startOffset = range.startOffset; - while ( isInline( startContainer ) ) { + // If in the middle or end of a text node, we're not at the boundary. + if ( startContainer.nodeType === TEXT_NODE ) { if ( startOffset ) { return false; } - parent = startContainer.parentNode; - startOffset = indexOf.call( parent.childNodes, startContainer ); - startContainer = parent; + contentWalker.currentNode = startContainer; + } else { + contentWalker.currentNode = getNodeAfter( startContainer, startOffset ); } - // Skip empty text nodes and
s. - while ( startOffset && - ( child = startContainer.childNodes[ startOffset - 1 ] ) && - ( child.data === '' || child.nodeName === 'BR' ) ) { - startOffset -= 1; - } - return !startOffset; + + // Otherwise, look for any previous content in the same block. + contentWalker.root = getStartBlockOfRange( range ); + + return !contentWalker.previousNode(); }; var rangeDoesEndAtBlockBoundary = function ( range ) { var endContainer = range.endContainer, endOffset = range.endOffset, - length = getLength( endContainer ), - parent, child; + length; - while ( isInline( endContainer ) ) { - if ( endOffset !== length ) { + // If in a text node with content, and not at the end, we're not + // at the boundary + if ( endContainer.nodeType === TEXT_NODE ) { + length = endContainer.data.length; + if ( length && endOffset < length ) { return false; } - parent = endContainer.parentNode; - endOffset = indexOf.call( parent.childNodes, endContainer ) + 1; - endContainer = parent; - length = endContainer.childNodes.length; + contentWalker.currentNode = endContainer; + } else { + contentWalker.currentNode = getNodeBefore( endContainer, endOffset ); } - // Skip empty text nodes and
s. - while ( endOffset < length && - ( child = endContainer.childNodes[ endOffset ] ) && - ( child.data === '' || child.nodeName === 'BR' ) ) { - endOffset += 1; - } - return endOffset === length; + + // Otherwise, look for any further content in the same block. + contentWalker.root = getEndBlockOfRange( range ); + + return !contentWalker.nextNode(); }; var expandRangeToBlockBoundaries = function ( range ) { @@ -1111,73 +1083,9 @@ var expandRangeToBlockBoundaries = function ( range ) { range.setEnd( parent, indexOf.call( parent.childNodes, end ) + 1 ); } }; -/*global - DOCUMENT_POSITION_PRECEDING, - ELEMENT_NODE, - TEXT_NODE, - SHOW_ELEMENT, - SHOW_TEXT, - FILTER_ACCEPT, - FILTER_SKIP, - win, - isIOS, - isMac, - isGecko, - isIE8or9or10, - isIE8, - isOpera, - ctrlKey, - useTextFixer, - cantFocusEmptyTextNodes, - losesSelectionOnBlur, - hasBuggySplit, - notWS, - indexOf, +/*jshint strict:false, undef:false, unused:false */ - TreeWalker, - - hasTagAttributes, - isLeaf, - isInline, - isBlock, - isContainer, - getBlockWalker, - getPreviousBlock, - getNextBlock, - getNearest, - getPath, - getLength, - detach, - replaceWith, - empty, - fixCursor, - split, - mergeInlines, - mergeWithBlock, - mergeContainers, - fixContainer, - createElement, - - forEachTextNodeInRange, - getTextContentInRange, - insertNodeInRange, - extractContentsOfRange, - deleteContentsOfRange, - insertTreeFragmentIntoRange, - isNodeContainedInRange, - moveRangeBoundariesDownTree, - moveRangeBoundariesUpTree, - getStartBlockOfRange, - getEndBlockOfRange, - rangeDoesStartAtBlockBoundary, - rangeDoesEndAtBlockBoundary, - expandRangeToBlockBoundaries, - - top, - console, - setTimeout -*/ -/*jshint strict:false */ +var instances = []; function Squire ( doc ) { var win = doc.defaultView; @@ -1227,7 +1135,7 @@ function Squire ( doc ) { this.addEventListener( 'keyup', this._ieSelAllClean ); } // Opera does not fire keydown repeatedly. - this.addEventListener( isOpera ? 'keypress' : 'keydown', this._onKey ); + this.addEventListener( isPresto ? 'keypress' : 'keydown', this._onKey ); // Fix IE8/9's buggy implementation of Text#splitText. // If the split is at the end of the node, it doesn't insert the newly split @@ -1235,7 +1143,7 @@ function Squire ( doc ) { // And even if the split is not at the end, the original node is removed // from the document and replaced by another, rather than just having its // data shortened. - if ( hasBuggySplit ) { + if ( hasBuggySplit( doc ) ) { win.Text.prototype.splitText = function ( offset ) { var afterSplit = this.ownerDocument.createTextNode( this.data.slice( offset ) ), @@ -1262,6 +1170,8 @@ function Squire ( doc ) { doc.execCommand( 'enableObjectResizing', false, 'false' ); doc.execCommand( 'enableInlineTableEditing', false, 'false' ); } catch ( error ) {} + + instances.push( this ); } var proto = Squire.prototype; @@ -1323,6 +1233,26 @@ proto.fireEvent = function ( type, event ) { return this; }; +proto.destroy = function () { + var win = this._win, + doc = this._doc, + events = this._events, + type; + win.removeEventListener( 'focus', this, false ); + win.removeEventListener( 'blur', this, false ); + for ( type in events ) { + if ( !customEvents[ type ] ) { + doc.removeEventListener( type, this, true ); + } + } + var l = instances.length; + while ( l-- ) { + if ( instances[l] === this ) { + instances.splice( l, 1 ); + } + } +}; + proto.handleEvent = function ( event ) { this.fireEvent( event.type, event ); }; @@ -1339,7 +1269,7 @@ proto.addEventListener = function ( type, fn ) { if ( !handlers ) { handlers = this._events[ type ] = []; if ( !customEvents[ type ] ) { - this._doc.addEventListener( type, this, false ); + this._doc.addEventListener( type, this, true ); } } handlers.push( fn ); @@ -1453,7 +1383,7 @@ proto._removeZWS = function () { return; } var walker = new TreeWalker( this._body, SHOW_TEXT, function () { - return FILTER_ACCEPT; + return true; }, false ), node, index; while ( node = walker.nextNode() ) { @@ -1493,11 +1423,10 @@ proto._updatePathOnEvent = function () { // --- Focus --- proto.focus = function () { - // FF seems to need the body to be focussed - // (at least on first load). - if ( isGecko ) { - this._body.focus(); - } + // FF seems to need the body to be focussed (at least on first load). + // Chrome also now needs body to be focussed in order to show the cursor + // (otherwise it is focussed, but the cursor doesn't appear). + this._body.focus(); this._win.focus(); return this; }; @@ -1710,8 +1639,7 @@ proto.hasFormat = function ( tag, attributes, range ) { // Otherwise, check each text node at least partially contained within // the selection and make sure all of them have the format we want. walker = new TreeWalker( root, SHOW_TEXT, function ( node ) { - return isNodeContainedInRange( range, node, true ) ? - FILTER_ACCEPT : FILTER_SKIP; + return isNodeContainedInRange( range, node, true ); }, false ); var seenNode = false; @@ -1729,7 +1657,7 @@ proto._addFormat = function ( tag, attributes, range ) { // If the range is collapsed we simply insert the node by wrapping // it round the range and focus it. var el, walker, startContainer, endContainer, startOffset, endOffset, - textnode, needsFormat; + textNode, needsFormat; if ( range.collapsed ) { el = fixCursor( this.createElement( tag, attributes ) ); @@ -1750,47 +1678,54 @@ proto._addFormat = function ( tag, attributes, range ) { range.commonAncestorContainer, SHOW_TEXT, function ( node ) { - return isNodeContainedInRange( range, node, true ) ? - FILTER_ACCEPT : FILTER_SKIP; + return isNodeContainedInRange( range, node, true ); }, false ); // Start at the beginning node of the range and iterate through // all the nodes in the range that need formatting. - startOffset = 0; - endOffset = 0; - textnode = walker.currentNode = range.startContainer; + startContainer = range.startContainer; + startOffset = range.startOffset; + endContainer = range.endContainer; + endOffset = range.endOffset; - if ( textnode.nodeType !== TEXT_NODE ) { - textnode = walker.nextNode(); + // Make sure we start inside a text node. + walker.currentNode = startContainer; + if ( startContainer.nodeType !== TEXT_NODE ) { + startContainer = walker.nextNode(); + startOffset = 0; } do { - needsFormat = !getNearest( textnode, tag, attributes ); - if ( textnode === range.endContainer ) { - if ( needsFormat && textnode.length > range.endOffset ) { - textnode.splitText( range.endOffset ); - } else { - endOffset = range.endOffset; - } - } - if ( textnode === range.startContainer ) { - if ( needsFormat && range.startOffset ) { - textnode = textnode.splitText( range.startOffset ); - } else { - startOffset = range.startOffset; - } - } + textNode = walker.currentNode; + needsFormat = !getNearest( textNode, tag, attributes ); if ( needsFormat ) { + if ( textNode === endContainer && + textNode.length > endOffset ) { + textNode.splitText( endOffset ); + } + if ( textNode === startContainer && startOffset ) { + textNode = textNode.splitText( startOffset ); + if ( endContainer === startContainer ) { + endContainer = textNode; + endOffset -= startOffset; + } + startContainer = textNode; + startOffset = 0; + } el = this.createElement( tag, attributes ); - replaceWith( textnode, el ); - el.appendChild( textnode ); - endOffset = textnode.length; + replaceWith( textNode, el ); + el.appendChild( textNode ); } - endContainer = textnode; - if ( !startContainer ) { startContainer = endContainer; } - } while ( textnode = walker.nextNode() ); + } while ( walker.nextNode() ); + + // Make sure we finish inside a text node. Otherwise offset may have + // changed. + if ( endContainer.nodeType !== TEXT_NODE ) { + endContainer = textNode; + endOffset = textNode.length; + } // Now set the selection to as it was before range = this._createRange( @@ -2125,6 +2060,7 @@ var makeOrderedList = function ( frag ) { return frag; }; + var removeList = function ( frag ) { var lists = frag.querySelectorAll( 'UL, OL' ), i, l, ll, list, listFrag, children, child; @@ -2210,7 +2146,7 @@ var addLinks = function ( frag ) { var doc = frag.ownerDocument, walker = new TreeWalker( frag, SHOW_TEXT, function ( node ) { - return getNearest( node, 'A' ) ? FILTER_SKIP : FILTER_ACCEPT; + return !getNearest( node, 'A' ); }, false ), node, data, parent, match, index, endIndex, child; while ( node = walker.nextNode() ) { @@ -2482,6 +2418,14 @@ var cleanTree = function ( node, allowStyles ) { } continue; } + // If we have just white space, it may still be important if it + // separates two inline nodes, e.g. "link link". + else if ( i && i + 1 < l && + isInline( children[ i - 1 ] ) && + isInline( children[ i + 1 ] ) ) { + child.data = ' '; + continue; + } } node.removeChild( child ); i -= 1; @@ -2492,10 +2436,9 @@ var cleanTree = function ( node, allowStyles ) { }; var notWSTextNode = function ( node ) { - return ( node.nodeType === ELEMENT_NODE ? + return node.nodeType === ELEMENT_NODE ? node.nodeName === 'BR' : - notWS.test( node.data ) ) ? - FILTER_ACCEPT : FILTER_SKIP; + notWS.test( node.data ); }; var isLineBreak = function ( br ) { var block = br.parentNode, @@ -2539,17 +2482,23 @@ var cleanupBRs = function ( root ) { block = block.parentNode; } // If this is not inside a block, replace it by wrapping - // inlines in DIV. - if ( !isBlock( block ) || !tagAfterSplit[ block.nodeName ] ) { + // inlines in a
. + if ( !isBlock( block ) ) { fixContainer( block ); } - // If in a block we can split, split it instead, but only if there - // is actual text content in the block. Otherwise, the
is a - // placeholder to stop the block from collapsing, so we must leave - // it. else { + // If it doesn't break a line, just remove it; it's not doing + // anything useful. We'll add it back later if required by the + // browser. If it breaks a line, split the block or leave it as + // appropriate. if ( brBreaksLine[l] ) { - splitBlock( block, br.parentNode, br ); + // If in a
, split, but anywhere else we might change + // the formatting too much (e.g.
  • -> to two list items!) + // so just play it safe and leave it. + if ( block.nodeName !== 'DIV' ) { + continue; + } + split( br.parentNode, br, block.parentNode ); } detach( br ); } @@ -2631,11 +2580,20 @@ proto._onPaste = function ( event ) { startContainer = range.startContainer, startOffset = range.startOffset, endContainer = range.endContainer, - endOffset = range.endOffset; + endOffset = range.endOffset, + startBlock = getStartBlockOfRange( range ); + // Record undo checkpoint + self._recordUndoState( range ); + self._getRangeAndRemoveBookmark( range ); + + // We need to position the pasteArea in the visible portion of the screen + // to stop the browser auto-scrolling. var pasteArea = this.createElement( 'DIV', { style: 'position: absolute; overflow: hidden; top:' + - (body.scrollTop + 30) + 'px; left: 0; width: 1px; height: 1px;' + ( body.scrollTop + + ( startBlock ? startBlock.getBoundingClientRect().top : 0 ) ) + + 'px; left: 0; width: 1px; height: 1px;' }); body.appendChild( pasteArea ); range.selectNodeContents( pasteArea ); @@ -2794,8 +2752,11 @@ var keyHandlers = { if ( !range ) { return; } // Save undo checkpoint and add any links in the preceding section. + // Remove any zws so we don't think there's content in an empty + // block. self._recordUndoState( range ); addLinks( range.startContainer ); + self._removeZWS(); self._getRangeAndRemoveBookmark( range ); // Selected text is overwritten, therefore delete the contents @@ -2903,7 +2864,7 @@ var keyHandlers = { // If you try to select the contents of a 'BR', FF will not let // you type anything! if ( !child || child.nodeName === 'BR' || - ( child.nodeType === TEXT_NODE && !isOpera ) ) { + ( child.nodeType === TEXT_NODE && !isPresto ) ) { break; } nodeAfterSplit = child; @@ -2928,11 +2889,13 @@ var keyHandlers = { self._docWasChanged(); }, backspace: function ( self, event ) { + self._removeZWS(); + // Record undo checkpoint. var range = self.getSelection(); + self._recordUndoState( range ); + self._getRangeAndRemoveBookmark( range ); // If not collapsed, delete contents if ( !range.collapsed ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); event.preventDefault(); deleteContentsOfRange( range ); self._ensureBottomLine(); @@ -2941,8 +2904,6 @@ var keyHandlers = { } // If at beginning of block, merge with previous else if ( rangeDoesStartAtBlockBoundary( range ) ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); event.preventDefault(); var current = getStartBlockOfRange( range ), previous = current && getPreviousBlock( current ); @@ -2985,21 +2946,18 @@ var keyHandlers = { // Otherwise, leave to browser but check afterwards whether it has // left behind an empty inline tag. else { - var text = range.startContainer.data || ''; - if ( !notWS.test( text.charAt( range.startOffset - 1 ) ) ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); - self.setSelection( range ); - } + self.setSelection( range ); setTimeout( function () { afterDelete( self ); }, 0 ); } }, 'delete': function ( self, event ) { + self._removeZWS(); + // Record undo checkpoint. var range = self.getSelection(); + self._recordUndoState( range ); + self._getRangeAndRemoveBookmark( range ); // If not collapsed, delete contents if ( !range.collapsed ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); event.preventDefault(); deleteContentsOfRange( range ); self._ensureBottomLine(); @@ -3008,8 +2966,6 @@ var keyHandlers = { } // If at end of block, merge next into this block else if ( rangeDoesEndAtBlockBoundary( range ) ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); event.preventDefault(); var current = getStartBlockOfRange( range ), next = current && getNextBlock( current ); @@ -3038,17 +2994,12 @@ var keyHandlers = { // Otherwise, leave to browser but check afterwards whether it has // left behind an empty inline tag. else { - // Record undo point if deleting whitespace - var text = range.startContainer.data || ''; - if ( !notWS.test( text.charAt( range.startOffset ) ) ) { - self._recordUndoState( range ); - self._getRangeAndRemoveBookmark( range ); - self.setSelection( range ); - } + self.setSelection( range ); setTimeout( function () { afterDelete( self ); }, 0 ); } }, tab: function ( self, event ) { + self._removeZWS(); var range = self.getSelection(), node, parent; // If no selection and in an empty block @@ -3087,6 +3038,7 @@ var keyHandlers = { self._removeZWS(); } }; + // Firefox incorrectly handles Cmd-left/Cmd-right on Mac: // it goes back/forward in history! Override to do the right // thing. @@ -3132,7 +3084,7 @@ proto._onKey = function ( event ) { // On keypress, delete and '.' both have event.keyCode 46 // Must check event.which to differentiate. - if ( isOpera && event.which === 46 ) { + if ( isPresto && event.which === 46 ) { key = '.'; } @@ -3141,9 +3093,15 @@ proto._onKey = function ( event ) { key = 'f' + ( code - 111 ); } - if ( event.altKey ) { modifiers += 'alt-'; } - if ( event.ctrlKey ) { modifiers += 'ctrl-'; } - if ( event.metaKey ) { modifiers += 'meta-'; } + // We need to apply the backspace/delete handlers regardless of + // control key modifiers. + if ( key !== 'backspace' && key !== 'delete' ) { + if ( event.altKey ) { modifiers += 'alt-'; } + if ( event.ctrlKey ) { modifiers += 'ctrl-'; } + if ( event.metaKey ) { modifiers += 'meta-'; } + } + // However, on Windows, shift-delete is apparently "cut" (WTF right?), so + // we want to let the browser handle shift-delete. if ( event.shiftKey ) { modifiers += 'shift-'; } key = modifiers + key; @@ -3454,6 +3412,23 @@ proto.setTextDirection = function ( direction ) { return this.focus(); }; +proto.makeHeading = function () { + var range = this.getSelection(); + this.changeFormat({ + tag: 'H1', + }, null, range ); + return this.focus(); +}; + +proto.removeHeading = function () { + var range = this.getSelection(); + this.changeFormat( null, { + tag: 'H1', + attributes: {} + }, range, false); + return this.focus(); +}; + proto.increaseQuoteLevel = command( 'modifyBlocks', increaseBlockQuoteLevel ); proto.decreaseQuoteLevel = command( 'modifyBlocks', decreaseBlockQuoteLevel ); @@ -3463,7 +3438,6 @@ proto.removeList = command( 'modifyBlocks', removeList ); proto.increaseListLevel = command( 'modifyBlocks', increaseListLevel ); proto.decreaseListLevel = command( 'modifyBlocks', decreaseListLevel ); -/*global top, win, doc, Squire */ if ( top !== win ) { win.editor = new Squire( doc ); diff --git a/build/squire.js b/build/squire.js index 80873b6..f243e06 100644 --- a/build/squire.js +++ b/build/squire.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n}function r(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function o(e,t,n){if(e.nodeName!==t)return!1;for(var r in n)if(e.getAttribute(r)!==n[r])return!1;return!0}function i(e,t){return e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function a(e){return e.nodeType===A&&!!rt[e.nodeName]}function s(e){return nt.test(e.nodeName)}function d(e){return e.nodeType===A&&!s(e)&&r(e.childNodes,s)}function l(e){return e.nodeType===A&&!s(e)&&!d(e)}function c(e){return d(e)?D:I}function f(e){var t=e.ownerDocument,r=new n(t.body,x,c,!1);return r.currentNode=e,r}function h(e){return f(e).previousNode()}function u(e){return f(e).nextNode()}function p(e,t,n){do if(o(e,t,n))return e;while(e=e.parentNode);return null}function m(e){var t,n,r,o,i=e.parentNode;return i&&e.nodeType===A?(t=m(i),t+=(t?">":"")+e.nodeName,(n=e.id)&&(t+="#"+n),(r=e.className.trim())&&(o=r.split(/\s\s*/),o.sort(),t+=".",t+=o.join("."))):t=i?m(i):"",t}function g(e){var t=e.nodeType;return t===A?e.childNodes.length:e.length||0}function v(e){var t=e.parentNode;return t&&t.removeChild(e),e}function N(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function S(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,r=n?n.length:0;r--;)t.appendChild(e.firstChild);return t}function C(e){var t,n,r=e.ownerDocument,o=e;if("BODY"===e.nodeName&&((n=e.firstChild)&&"BR"!==n.nodeName||(t=r.createElement("DIV"),n?e.replaceChild(t,n):e.appendChild(t),e=t,t=null)),s(e))e.firstChild||(Y?(t=r.createTextNode("​"),V.editor&&V.editor._didAddZWS()):t=r.createTextNode(""));else if($){for(;e.nodeType!==O&&!a(e);){if(n=e.firstChild,!n){t=r.createTextNode("");break}e=n}e.nodeType===O?/^ +$/.test(e.data)&&(e.data=""):a(e)&&e.parentNode.insertBefore(r.createTextNode(""),e)}else if(!e.querySelector("BR"))for(t=r.createElement("BR");(n=e.lastElementChild)&&!s(n);)e=n;return t&&e.appendChild(t),o}function _(e,t,n){var r,o,i,a=e.nodeType;if(a===O&&e!==n)return _(e.parentNode,e.splitText(t),n);if(a===A){if("number"==typeof t&&(t=td?t.startOffset-=1:t.startOffset===d&&(t.startContainer=r,t.startOffset=g(r))),t.endContainer===e&&(t.endOffset>d?t.endOffset-=1:t.endOffset===d&&(t.endContainer=r,t.endOffset=g(r))),v(n),n.nodeType===O?r.appendData(n.data):l.push(S(n));else if(n.nodeType===A){for(o=l.length;o--;)n.appendChild(l.pop());y(n,t)}}function E(e,t,n){for(var r,o,i,a=t;1===a.parentNode.childNodes.length;)a=a.parentNode;v(a),o=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),o-=1),i={startContainer:e,startOffset:o,endContainer:e,endOffset:o},e.appendChild(S(t)),y(e,i),n.setStart(i.startContainer,i.startOffset),n.collapse(!0),Z&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}function T(e){var t,n,r=e.previousSibling,o=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if(!s||o&&/^[OU]L$/.test(o.nodeName))if(r&&i(r,e)){if(!l(r)){if(!s)return;n=a.createElement("DIV"),n.appendChild(S(r)),r.appendChild(n)}v(e),t=!l(e),r.appendChild(S(e)),t&&B(r),o&&T(o)}else s&&(r=a.createElement("DIV"),e.insertBefore(r,o),C(r))}function B(e){var t,n,r,o,i=e.childNodes,a=e.ownerDocument,d=null;for(t=0,n=i.length;n>t;t+=1)r=i[t],o="BR"===r.nodeName,!o&&s(r)?(d||(d=k(a,"DIV")),d.appendChild(r),t-=1,n-=1):(o||d)&&(d||(d=k(a,"DIV")),C(d),o?e.replaceChild(d,r):(e.insertBefore(d,r),t+=1,n+=1),d=null),l(r)&&B(r);return d&&e.appendChild(C(d)),e}function k(e,n,r,o){var i,a,s,d,l=e.createElement(n);if(r instanceof Array&&(o=r,r=null),r)for(i in r)a=r[i],a!==t&&l.setAttribute(i,r[i]);if(o)for(s=0,d=o.length;d>s;s+=1)l.appendChild(o[s]);return l}function b(e){var n=e.defaultView,r=e.body;this._win=n,this._doc=e,this._body=r,this._events={},this._lastSelection=null,j&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent),n.addEventListener("focus",this,!1),n.addEventListener("blur",this,!1),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this.defaultBlockProperties=t,this.addEventListener("keyup",this._docWasChanged),this._awaitingPaste=!1,this.addEventListener(z?"beforecut":"cut",this._onCut),this.addEventListener(z?"beforepaste":"paste",this._onPaste),q&&this.addEventListener("keyup",this._ieSelAllClean),this.addEventListener(Z?"keypress":"keydown",this._onKey),X&&(n.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,r=this.parentNode,o=this.length-e;return n?r.insertBefore(t,n):r.appendChild(t),o&&this.deleteData(e,o),t}),r.setAttribute("contenteditable","true"),this.setHTML("");try{e.execCommand("enableObjectResizing",!1,"false"),e.execCommand("enableInlineTableEditing",!1,"false")}catch(o){}}var R=2,A=1,O=3,x=1,L=4,D=1,I=3,P=0,U=1,w=2,F=3,V=e.defaultView,H=navigator.userAgent,M=/iP(?:ad|hone|od)/.test(H),W=/Mac OS X/.test(H),K=/Gecko\//.test(H),z=/Trident\/[456]\./.test(H),q=8===V.ie,Z=!!V.opera,Q=/WebKit\//.test(H),G=W?"meta-":"ctrl-",$=z||Z,Y=z||Q,j=z,X=function(){var t=e.createElement("DIV"),n=e.createTextNode("12");return t.appendChild(n),n.splitText(2),2!==t.childNodes.length}(),J=/[^ \t\r\n]/,et=Array.prototype.indexOf,tt={1:1,2:2,3:4,8:128,9:256,11:1024};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,r=this.nodeType,o=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)e=t.nextSibling,e||(t=t.parentNode);if(!e)return null;if(tt[e.nodeType]&r&&o(e)===D)return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,r=this.nodeType,o=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(tt[e.nodeType]&r&&o(e)===D)return this.currentNode=e,e;t=e}};var nt=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|FN|EL)|EM|FONT|HR|I(?:NPUT|MG|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:U[BP]|PAN|TR(?:IKE|ONG)|MALL|AMP)?|U|VAR|WBR)$/,rt={BR:1,IMG:1,INPUT:1},ot=function(e,t){for(var n=e.childNodes;t&&e.nodeType===A;)e=n[t-1],n=e.childNodes,t=n.length;return e},it=function(e,t){if(e.nodeType===A){var n=e.childNodes;if(t-1,i=e.compareBoundaryPoints(U,r)<1;return!o&&!i}var a=e.compareBoundaryPoints(P,r)<1,s=e.compareBoundaryPoints(w,r)>-1;return a&&s},ut=function(e){for(var t,n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset;n.nodeType!==O&&(t=n.childNodes[r],t&&!a(t));)n=t,r=0;if(i)for(;o.nodeType!==O&&(t=o.childNodes[i-1],t&&!a(t));)o=t,i=g(o);else for(;o.nodeType!==O&&(t=o.firstChild,t&&!a(t));)o=t;e.collapsed?(e.setStart(o,i),e.setEnd(n,r)):(e.setStart(n,r),e.setEnd(o,i))},pt=function(e,t){var n,r=e.startContainer,o=e.startOffset,i=e.endContainer,a=e.endOffset;for(t||(t=e.commonAncestorContainer);r!==t&&!o;)n=r.parentNode,o=et.call(n.childNodes,r),r=n;for(;i!==t&&a===g(i);)n=i.parentNode,a=et.call(n.childNodes,i)+1,i=n;e.setStart(r,o),e.setEnd(i,a)},mt=function(e){var t,n=e.startContainer;return s(n)?t=h(n):d(n)?t=n:(t=ot(n,e.startOffset),t=u(t)),t&&ht(e,t,!0)?t:null},gt=function(e){var t,n,r=e.endContainer;if(s(r))t=h(r);else if(d(r))t=r;else{if(t=it(r,e.endOffset),!t)for(t=r.ownerDocument.body;n=t.lastChild;)t=n;t=h(t)}return t&&ht(e,t,!0)?t:null},vt=function(e){for(var t,n,r=e.startContainer,o=e.startOffset;s(r);){if(o)return!1;t=r.parentNode,o=et.call(t.childNodes,r),r=t}for(;o&&(n=r.childNodes[o-1])&&(""===n.data||"BR"===n.nodeName);)o-=1;return!o},Nt=function(e){for(var t,n,r=e.endContainer,o=e.endOffset,i=g(r);s(r);){if(o!==i)return!1;t=r.parentNode,o=et.call(t.childNodes,r)+1,r=t,i=r.childNodes.length}for(;i>o&&(n=r.childNodes[o])&&(""===n.data||"BR"===n.nodeName);)o+=1;return o===i},St=function(e){var t,n=mt(e),r=gt(e);n&&r&&(t=n.parentNode,e.setStart(t,et.call(t.childNodes,n)),t=r.parentNode,e.setEnd(t,et.call(t.childNodes,r)+1))},Ct=b.prototype;Ct.createElement=function(e,t,n){return k(this._doc,e,t,n)},Ct.createDefaultBlock=function(e){return C(this.createElement("DIV",this.defaultBlockProperties,e))},Ct.didError=function(e){console.log(e)},Ct.getDocument=function(){return this._doc};var _t={focus:1,blur:1,pathChange:1,select:1,input:1,undoStateChange:1};Ct.fireEvent=function(e,t){var n,r,o,i=this._events[e];if(i)for(t||(t={}),t.type!==e&&(t.type=e),i=i.slice(),n=0,r=i.length;r>n;n+=1){o=i[n];try{o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(a){a.details="Squire: fireEvent error. Event type: "+e,this.didError(a)}}return this},Ct.handleEvent=function(e){this.fireEvent(e.type,e)},Ct.addEventListener=function(e,t){var n=this._events[e];return t?(n||(n=this._events[e]=[],_t[e]||this._doc.addEventListener(e,this,!1)),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},Ct.removeEventListener=function(e,t){var n,r=this._events[e];if(r){for(n=r.length;n--;)r[n]===t&&r.splice(n,1);r.length||(delete this._events[e],_t[e]||this._doc.removeEventListener(e,this,!1))}return this},Ct._createRange=function(e,t,n,r){if(e instanceof this._win.Range)return e.cloneRange();var o=this._doc.createRange();return o.setStart(e,t),n?o.setEnd(n,r):o.setEnd(e,t),o},Ct.setSelection=function(e){if(e){M&&this._win.focus();var t=this._win.getSelection();t.removeAllRanges(),t.addRange(e)}return this},Ct.getSelection=function(){var e,t,n,r=this._win.getSelection();if(r.rangeCount){e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer;try{t&&a(t)&&e.setStartBefore(t),n&&a(n)&&e.setEndBefore(n)}catch(o){this.didError({name:"Squire#getSelection error",message:"Starts: "+t.nodeName+"\nEnds: "+n.nodeName})}this._lastSelection=e}else e=this._lastSelection;return e||(e=this._createRange(this._body.firstChild,0)),e},Ct.getSelectedText=function(){return st(this.getSelection())},Ct.getPath=function(){return this._path},Ct._didAddZWS=function(){this._hasZWS=!0},Ct._removeZWS=function(){if(this._hasZWS){for(var e,t,r=new n(this._body,L,function(){return D},!1);e=r.nextNode();)for(;(t=e.data.indexOf("​"))>-1;)e.deleteData(t,1);this._hasZWS=!1}},Ct._updatePath=function(e,t){var n,r=e.startContainer,o=e.endContainer;(t||r!==this._lastAnchorNode||o!==this._lastFocusNode)&&(this._lastAnchorNode=r,this._lastFocusNode=o,n=r&&o?r===o?m(o):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),r!==o&&this.fireEvent("select")},Ct._updatePathOnEvent=function(){this._updatePath(this.getSelection())},Ct.focus=function(){return K&&this._body.focus(),this._win.focus(),this},Ct.blur=function(){return K&&this._body.blur(),top.focus(),this};var yt="squire-selection-start",Et="squire-selection-end";Ct._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:yt,type:"hidden"}),r=this.createElement("INPUT",{id:Et,type:"hidden"});dt(e,n),e.collapse(!1),dt(e,r),n.compareDocumentPosition(r)&R&&(n.id=Et,r.id=yt,t=n,n=r,r=t),e.setStartAfter(n),e.setEndBefore(r)},Ct._getRangeAndRemoveBookmark=function(e){var t=this._doc,n=t.getElementById(yt),r=t.getElementById(Et);if(n&&r){var o,i=n.parentNode,a=r.parentNode,s={startContainer:i,endContainer:a,startOffset:et.call(i.childNodes,n),endOffset:et.call(a.childNodes,r)};i===a&&(s.endOffset-=1),v(n),v(r),y(i,s),i!==a&&y(a,s),e||(e=t.createRange()),e.setStart(s.startContainer,s.startOffset),e.setEnd(s.endContainer,s.endOffset),o=e.collapsed,ut(e),o&&e.collapse(!0)}return e||null},Ct._docWasChanged=function(e){var t=e&&e.keyCode;(!e||!e.ctrlKey&&!e.metaKey&&!e.altKey&&(16>t||t>20)&&(33>t||t>45))&&(this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input"))},Ct._recordUndoState=function(e){if(!this._isInUndoState){var t=this._undoIndex+=1,n=this._undoStack;te+1&&this._isInUndoState){this._undoIndex+=1,this._setHTML(this._undoStack[this._undoIndex]);var n=this._getRangeAndRemoveBookmark();n&&this.setSelection(n),this.fireEvent("undoStateChange",{canUndo:!0,canRedo:t>e+2}),this.fireEvent("input")}return this},Ct.hasFormat=function(e,t,r){if(e=e.toUpperCase(),t||(t={}),!r&&!(r=this.getSelection()))return!1;var o,i,a=r.commonAncestorContainer;if(p(a,e,t))return!0;if(a.nodeType===O)return!1;o=new n(a,L,function(e){return ht(r,e,!0)?D:I},!1);for(var s=!1;i=o.nextNode();){if(!p(i,e,t))return!1;s=!0}return s},Ct._addFormat=function(e,t,r){var o,i,a,s,d,l,c,f;if(r.collapsed)o=C(this.createElement(e,t)),dt(r,o),r.setStart(o.firstChild,o.firstChild.length),r.collapse(!0);else{i=new n(r.commonAncestorContainer,L,function(e){return ht(r,e,!0)?D:I},!1),d=0,l=0,c=i.currentNode=r.startContainer,c.nodeType!==O&&(c=i.nextNode());do f=!p(c,e,t),c===r.endContainer&&(f&&c.length>r.endOffset?c.splitText(r.endOffset):l=r.endOffset),c===r.startContainer&&(f&&r.startOffset?c=c.splitText(r.startOffset):d=r.startOffset),f&&(o=this.createElement(e,t),N(c,o),o.appendChild(c),l=c.length),s=c,a||(a=s);while(c=i.nextNode());r=this._createRange(a,d,s,l)}return r},Ct._removeFormat=function(e,t,n,r){this._saveRangeToBookmark(n);var i,a=this._doc;n.collapsed&&(Y?(i=a.createTextNode("​"),this._didAddZWS()):i=a.createTextNode(""),dt(n,i));for(var d=n.commonAncestorContainer;s(d);)d=d.parentNode;var l=n.startContainer,c=n.startOffset,f=n.endContainer,h=n.endOffset,u=[],p=function(e,t){if(!ht(n,e,!1)){var r,o,i=e.nodeType===O;if(!ht(n,e,!0))return void("INPUT"===e.nodeName||i&&!e.data||u.push([t,e]));if(i)e===f&&h!==e.length&&u.push([t,e.splitText(h)]),e===l&&c&&(e.splitText(c),u.push([t,e]));else for(r=e.firstChild;r;r=o)o=r.nextSibling,p(r,t)}},m=Array.prototype.filter.call(d.getElementsByTagName(e),function(r){return ht(n,r,!0)&&o(r,e,t)});r||m.forEach(function(e){p(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];N(n,t),t.appendChild(n)}),m.forEach(function(e){N(e,S(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1);var g={startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset};return y(d,g),n.setStart(g.startContainer,g.startOffset),n.setEnd(g.endContainer,g.endOffset),n},Ct.changeFormat=function(e,t,n,r){return n||(n=this.getSelection())?(this._recordUndoState(n),this._getRangeAndRemoveBookmark(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,r)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),this._docWasChanged(),this):void 0};var Tt={DIV:"DIV",PRE:"DIV",H1:"DIV",H2:"DIV",H3:"DIV",H4:"DIV",H5:"DIV",H6:"DIV",P:"DIV",DT:"DD",DD:"DT",LI:"LI"},Bt=function(e,t,n){var r=Tt[e.nodeName],o=_(t,n,e.parentNode);return o.nodeName!==r&&(e=k(o.ownerDocument,r),e.className="rtl"===o.dir?"dir-rtl":"",e.dir=o.dir,N(o,e),e.appendChild(S(o)),o=e),o};Ct.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&(this._recordUndoState(n),this._getRangeAndRemoveBookmark(n));var r=mt(n),o=gt(n);if(r&&o)do if(e(r)||r===o)break;while(r=u(r));return t&&(this.setSelection(n),this._updatePath(n,!0),this._docWasChanged()),this},Ct.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._isInUndoState?this._saveRangeToBookmark(t):this._recordUndoState(t),St(t);var n,r=this._body;return pt(t,r),n=lt(t,r),dt(t,e.call(this,n)),t.endOffsett;t+=1){for(o=d[t],i=S(o),a=i.childNodes,r=a.length;r--;)s=a[r],N(s,S(s));B(i),N(o,i)}return e},Dt=function(e){var t,n,r,o,i,a=e.querySelectorAll("LI");for(t=0,n=a.length;n>t;t+=1)r=a[t],l(r.firstChild)||(o=r.parentNode.nodeName,i=r.previousSibling,i&&(i=i.lastChild)&&i.nodeName===o||N(r,this.createElement("LI",[i=this.createElement(o)])),i.appendChild(r));return e},It=function(e){var t=e.querySelectorAll("LI");return Array.prototype.filter.call(t,function(e){return!l(e.firstChild)}).forEach(function(t){var n,r=t.parentNode,o=r.parentNode,i=t.firstChild,a=i;for(t.previousSibling&&(r=_(r,t,o));a&&(n=a.nextSibling,!l(a));)o.insertBefore(a,r),a=n;for("LI"===o.nodeName&&i.previousSibling&&_(o,i,o.parentNode);t!==e&&!t.childNodes.length;)r=t.parentNode,r.removeChild(t),t=r},this),B(e),e},Pt=/\b((?:(?:ht|f)tps?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,}\/)(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)/i,Ut=function(e){for(var t,r,o,i,a,s,d,l=e.ownerDocument,c=new n(e,L,function(e){return p(e,"A")?I:D},!1);t=c.nextNode();)for(r=t.data,o=t.parentNode;i=Pt.exec(r);)a=i.index,s=a+i[0].length,a&&(d=l.createTextNode(r.slice(0,a)),o.insertBefore(d,t)),d=l.createElement("A"),d.textContent=r.slice(a,s),d.href=i[1]?/^(?:ht|f)tps?:/.test(i[1])?i[1]:"http://"+i[1]:"mailto:"+i[2],o.insertBefore(d,t),t.data=r=r.slice(s)},wt=/^(?:A(?:DDRESS|RTICLE|SIDE)|BLOCKQUOTE|CAPTION|D(?:[DLT]|IV)|F(?:IGURE|OOTER)|H[1-6]|HEADER|L(?:ABEL|EGEND|I)|O(?:L|UTPUT)|P(?:RE)?|SECTION|T(?:ABLE|BODY|D|FOOT|H|HEAD|R)|UL)$/,Ft={1:10,2:13,3:16,4:18,5:24,6:32,7:48},Vt={backgroundColor:{regexp:J,replace:function(e,t){return k(e,"SPAN",{"class":"highlight",style:"background-color: "+t})}},color:{regexp:J,replace:function(e,t){return k(e,"SPAN",{"class":"colour",style:"color:"+t})}},fontWeight:{regexp:/^bold/i,replace:function(e){return k(e,"B")}},fontStyle:{regexp:/^italic/i,replace:function(e){return k(e,"I")}},fontFamily:{regexp:J,replace:function(e,t){return k(e,"SPAN",{"class":"font",style:"font-family:"+t})}},fontSize:{regexp:J,replace:function(e,t){return k(e,"SPAN",{"class":"size",style:"font-size:"+t})}}},Ht=function(e){return function(t,n){var r=k(t.ownerDocument,e);return n.replaceChild(r,t),r.appendChild(S(t)),r}},Mt={SPAN:function(e,t){var n,r,o,i,a,s,d=e.style,l=e.ownerDocument;for(n in Vt)r=Vt[n],o=d[n],o&&r.regexp.test(o)&&(s=r.replace(l,o),i&&i.appendChild(s),i=s,a||(a=s));return a&&(i.appendChild(S(e)),t.replaceChild(a,e)),i||e},STRONG:Ht("B"),EM:Ht("I"),STRIKE:Ht("S"),FONT:function(e,t){var n,r,o,i,a,s=e.face,d=e.size,l=e.color,c=e.ownerDocument;return s&&(n=k(c,"SPAN",{"class":"font",style:"font-family:"+s}),a=n,i=n),d&&(r=k(c,"SPAN",{"class":"size",style:"font-size:"+Ft[d]+"px"}),a||(a=r),i&&i.appendChild(r),i=r),l&&/^#?([\dA-F]{3}){1,2}$/i.test(l)&&("#"!==l.charAt(0)&&(l="#"+l),o=k(c,"SPAN",{"class":"colour",style:"color:"+l}),a||(a=o),i&&i.appendChild(o),i=o),a||(a=i=k(c,"SPAN")),t.replaceChild(a,e),i.appendChild(S(e)),i},TT:function(e,t){var n=k(e.ownerDocument,"SPAN",{"class":"font",style:'font-family:menlo,consolas,"courier new",monospace'});return t.replaceChild(n,e),n.appendChild(S(e)),n}},Wt=function(e){for(var t,n=e.childNodes,r=n.length;r--;)t=n[r],t.nodeType===A&&"IMG"!==t.nodeName&&(Wt(t),s(t)&&!t.firstChild&&e.removeChild(t))},Kt=function(e,t){var n,r,o,i,a,d,l,c,f,h,u=e.childNodes;for(n=0,r=u.length;r>n;n+=1)if(o=u[n],i=o.nodeName,a=o.nodeType,d=Mt[i],a===A){if(l=o.childNodes.length,d)o=d(o,e);else{if(!wt.test(i)&&!s(o)){n-=1,r+=l-1,e.replaceChild(S(o),o);continue}!t&&o.style.cssText&&o.removeAttribute("style")}l&&Kt(o,t)}else{if(a===O&&(c=o.data,/\S/.test(c))){if(s(e))continue;if(f=0,h=c.length,!n||!s(u[n-1])){for(;h>f&&!J.test(c.charAt(f));)f+=1;f&&(o.data=c=c.slice(f),h-=f)}if(n+1===r||!s(u[n+1])){for(f=h;f>0&&!J.test(c.charAt(f-1));)f-=1;h>f&&(o.data=c.slice(0,f))}continue}e.removeChild(o),n-=1,r-=1}return e},zt=function(e){return(e.nodeType===A?"BR"===e.nodeName:J.test(e.data))?D:I},qt=function(e){for(var t,r=e.parentNode;s(r);)r=r.parentNode;return t=new n(r,x|L,zt),t.currentNode=e,!!t.nextNode()},Zt=function(e){var t,n,r,o=e.querySelectorAll("BR"),i=[],a=o.length;for(t=0;a>t;t+=1)i[t]=qt(o[t]);for(;a--;)if(n=o[a],r=n.parentNode){for(;s(r);)r=r.parentNode;d(r)&&Tt[r.nodeName]?(i[a]&&Bt(r,n.parentNode,n),v(n)):B(r)}};Ct._ensureBottomLine=function(){var e=this._body,t=e.lastChild;t&&"DIV"===t.nodeName&&d(t)||e.appendChild(this.createDefaultBlock())},Ct._onCut=function(){var e=this.getSelection(),t=this;this._recordUndoState(e),this._getRangeAndRemoveBookmark(e),this.setSelection(e),setTimeout(function(){try{t._ensureBottomLine()}catch(e){t.didError(e)}},0)},Ct._onPaste=function(e){if(!this._awaitingPaste){var t,n,r=e.clipboardData,o=r&&r.items,i=!1,a=!1;if(o){for(t=o.length;t--;){if(n=o[t].type,"text/html"===n){a=!1;break}/^image\/.*/.test(n)&&(a=!0)}if(a)return e.preventDefault(),this.fireEvent("dragover",{dataTransfer:r,preventDefault:function(){i=!0}}),void(i&&this.fireEvent("drop",{dataTransfer:r}))}this._awaitingPaste=!0;var s=this,d=this._body,l=this.getSelection(),c=l.startContainer,f=l.startOffset,h=l.endContainer,p=l.endOffset,m=this.createElement("DIV",{style:"position: absolute; overflow: hidden; top:"+(d.scrollTop+30)+"px; left: 0; width: 1px; height: 1px;"});d.appendChild(m),l.selectNodeContents(m),this.setSelection(l),setTimeout(function(){try{var e=S(v(m)),t=e.firstChild,n=s._createRange(c,f,h,p);if(t){t===e.lastChild&&"DIV"===t.nodeName&&e.replaceChild(S(t),t),e.normalize(),Ut(e),Kt(e,!1),Zt(e),Wt(e);for(var r=e,o=!0;r=u(r);)C(r);s.fireEvent("willPaste",{fragment:e,preventDefault:function(){o=!1}}),o&&(ft(n,e),s._docWasChanged(),n.collapse(!1),s._ensureBottomLine())}s.setSelection(n),s._updatePath(n,!0),s._awaitingPaste=!1}catch(i){s.didError(i)}},0)}};var Qt={8:"backspace",9:"tab",13:"enter",32:"space",37:"left",39:"right",46:"delete",219:"[",221:"]"},Gt=function(e){return function(t,n){n.preventDefault(),t[e]()}},$t=function(e,t){return t=t||null,function(n,r){r.preventDefault();var o=n.getSelection();n.hasFormat(e,null,o)?n.changeFormat(null,{tag:e},o):n.changeFormat({tag:e},t,o)}},Yt=function(e){try{var t,n=e.getSelection(),r=n.startContainer;if(r.nodeType===O&&(r=r.parentNode),s(r)&&!r.textContent){do t=r.parentNode;while(s(t)&&!t.textContent&&(r=t));n.setStart(t,et.call(t.childNodes,r)),n.collapse(!0),t.removeChild(r),d(t)||(t=h(t)),C(t),ut(n),e.setSelection(n),e._updatePath(n)}e._ensureBottomLine()}catch(o){e.didError(o)}};q&&(Ct._ieSelAllClean=function(){var e=this._body.firstChild;"P"===e.nodeName&&(this._saveRangeToBookmark(this.getSelection()),N(e,this.createDefaultBlock([S(e)])),this.setSelection(this._getRangeAndRemoveBookmark()))});var jt={enter:function(e,t){t.preventDefault();var n,r,o,i,a,s=e.getSelection();if(s){if(e._recordUndoState(s),Ut(s.startContainer),e._getRangeAndRemoveBookmark(s),s.collapsed||ct(s),n=mt(s),n&&(r=p(n,"LI"))&&(n=r),o=n?n.nodeName:"DIV",i=Tt[o],!n)return dt(s,e.createElement("BR")),s.collapse(!1),e.setSelection(s),e._updatePath(s,!0),void e._docWasChanged();var d,l=s.startContainer,c=s.startOffset;if(i||(l===n&&(l=c?l.childNodes[c-1]:null,c=0,l&&("BR"===l.nodeName?l=l.nextSibling:c=g(l),l&&"BR"!==l.nodeName||(d=C(e.createElement("DIV")),l?n.replaceChild(d,l):n.appendChild(d),l=d))),B(n),i="DIV",l||(l=n.firstChild),s.setStart(l,c),s.setEnd(l,c),n=mt(s)),!n.textContent){if(p(n,"UL")||p(n,"OL"))return e.modifyBlocks(It,s);if(p(n,"BLOCKQUOTE"))return e.modifyBlocks(Rt,s)}for(a=Bt(n,l,c);a.nodeType===A;){var f,h=a.firstChild;if("A"!==a.nodeName){for(;h&&h.nodeType===O&&!h.data&&(f=h.nextSibling,f&&"BR"!==f.nodeName);)v(h),h=f;if(!h||"BR"===h.nodeName||h.nodeType===O&&!Z)break;a=h}else N(a,S(a)),a=h}s=e._createRange(a,0),e.setSelection(s),e._updatePath(s,!0),a.nodeType===O&&(a=a.parentNode);var u=e._doc,m=e._body;a.offsetTop+a.offsetHeight>(u.documentElement.scrollTop||m.scrollTop)+m.offsetHeight&&a.scrollIntoView(!1),e._docWasChanged()}},backspace:function(e,t){var n=e.getSelection();if(n.collapsed)if(vt(n)){e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),t.preventDefault();var r=mt(n),o=r&&h(r);if(o){if(!o.isContentEditable)return void v(o);for(E(o,r,n),r=o.parentNode;r&&!r.nextSibling;)r=r.parentNode;r&&(r=r.nextSibling)&&T(r),e.setSelection(n)}else if(r){if(p(r,"UL")||p(r,"OL"))return e.modifyBlocks(It,n);if(p(r,"BLOCKQUOTE"))return e.modifyBlocks(bt,n);e.setSelection(n),e._updatePath(n,!0)}}else{var i=n.startContainer.data||"";J.test(i.charAt(n.startOffset-1))||(e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),e.setSelection(n)),setTimeout(function(){Yt(e)},0)}else e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),t.preventDefault(),ct(n),e._ensureBottomLine(),e.setSelection(n),e._updatePath(n,!0)},"delete":function(e,t){var n=e.getSelection();if(n.collapsed)if(Nt(n)){e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),t.preventDefault();var r=mt(n),o=r&&u(r);if(o){if(!o.isContentEditable)return void v(o);for(E(r,o,n),o=r.parentNode;o&&!o.nextSibling;)o=o.parentNode;o&&(o=o.nextSibling)&&T(o),e.setSelection(n),e._updatePath(n,!0)}}else{var i=n.startContainer.data||"";J.test(i.charAt(n.startOffset))||(e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),e.setSelection(n)),setTimeout(function(){Yt(e)},0)}else e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),t.preventDefault(),ct(n),e._ensureBottomLine(),e.setSelection(n),e._updatePath(n,!0)},tab:function(e,t){var n,r,o=e.getSelection();if(o.collapsed&&vt(o)&&Nt(o)){for(n=mt(o);r=n.parentNode;){if("UL"===r.nodeName||"OL"===r.nodeName){n.previousSibling&&(t.preventDefault(),e.modifyBlocks(Dt,o));break}n=r}t.preventDefault()}},space:function(e){var t=e.getSelection();e._recordUndoState(t),Ut(t.startContainer),e._getRangeAndRemoveBookmark(t),e.setSelection(t)},left:function(e){e._removeZWS()},right:function(e){e._removeZWS()}};W&&K&&V.getSelection().modify&&(jt["meta-left"]=function(e,t){t.preventDefault(),e._win.getSelection().modify("move","backward","lineboundary")},jt["meta-right"]=function(e,t){t.preventDefault(),e._win.getSelection().modify("move","forward","lineboundary")}),jt[G+"b"]=$t("B"),jt[G+"i"]=$t("I"),jt[G+"u"]=$t("U"),jt[G+"shift-7"]=$t("S"),jt[G+"shift-5"]=$t("SUB",{tag:"SUP"}),jt[G+"shift-6"]=$t("SUP",{tag:"SUB"}),jt[G+"shift-8"]=Gt("makeUnorderedList"),jt[G+"shift-9"]=Gt("makeOrderedList"),jt[G+"["]=Gt("decreaseQuoteLevel"),jt[G+"]"]=Gt("increaseQuoteLevel"),jt[G+"y"]=Gt("redo"),jt[G+"z"]=Gt("undo"),jt[G+"shift-z"]=Gt("redo"),Ct._onKey=function(e){var t=e.keyCode,n=Qt[t],r="";n||(n=String.fromCharCode(t).toLowerCase(),/^[A-Za-z0-9]$/.test(n)||(n="")),Z&&46===e.which&&(n="."),t>111&&124>t&&(n="f"+(t-111)),e.altKey&&(r+="alt-"),e.ctrlKey&&(r+="ctrl-"),e.metaKey&&(r+="meta-"),e.shiftKey&&(r+="shift-"),n=r+n,jt[n]&&jt[n](this,e)},Ct._getHTML=function(){return this._body.innerHTML},Ct._setHTML=function(e){var t=this._body;t.innerHTML=e;do C(t);while(t=u(t))},Ct.getHTML=function(e){var t,n,r,o,i,a=[];if(e&&(i=this.getSelection())&&this._saveRangeToBookmark(i),$)for(t=this._body;t=u(t);)t.textContent||t.querySelector("BR")||(n=this.createElement("BR"),t.appendChild(n),a.push(n));if(r=this._getHTML().replace(/\u200B/g,""),$)for(o=a.length;o--;)v(a[o]);return i&&this._getRangeAndRemoveBookmark(i),r},Ct.setHTML=function(e){var t,n=this._doc.createDocumentFragment(),r=this.createElement("DIV");r.innerHTML=e,n.appendChild(S(r)),Kt(n,!0),Zt(n),B(n);for(var o=n;o=u(o);)C(o);for(var i=this._body;t=i.lastChild;)i.removeChild(t);i.appendChild(n),C(i),this._undoIndex=-1,this._undoStack.length=0,this._undoStackLength=0,this._isInUndoState=!1;var a=this._getRangeAndRemoveBookmark()||this._createRange(i.firstChild,0);return this._recordUndoState(a),this._getRangeAndRemoveBookmark(a),j?this._lastSelection=a:this.setSelection(a),this._updatePath(a,!0),this},Ct.insertElement=function(e,t){if(t||(t=this.getSelection()),t.collapse(!0),s(e))dt(t,e),t.setStartAfter(e); -else{for(var n,r,o=this._body,i=mt(t)||o;i!==o&&!i.nextSibling;)i=i.parentNode;i!==o&&(n=i.parentNode,r=_(n,i.nextSibling,o)),r?(o.insertBefore(e,r),t.setStart(r,0),t.setStart(r,0),ut(t)):(o.appendChild(e),o.appendChild(this.createDefaultBlock()),t.setStart(e,0),t.setEnd(e,0)),this.focus(),this.setSelection(t),this._updatePath(t)}return this},Ct.insertImage=function(e){var t=this.createElement("IMG",{src:e});return this.insertElement(t),t};var Xt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};Ct.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.styleSheet?(t.appendChild(n),n.styleSheet.cssText=e):(n.appendChild(this._doc.createTextNode(e)),t.appendChild(n))}return this},Ct.bold=Xt("changeFormat",{tag:"B"}),Ct.italic=Xt("changeFormat",{tag:"I"}),Ct.underline=Xt("changeFormat",{tag:"U"}),Ct.strikethrough=Xt("changeFormat",{tag:"S"}),Ct.subscript=Xt("changeFormat",{tag:"SUB"},{tag:"SUP"}),Ct.superscript=Xt("changeFormat",{tag:"SUP"},{tag:"SUB"}),Ct.removeBold=Xt("changeFormat",null,{tag:"B"}),Ct.removeItalic=Xt("changeFormat",null,{tag:"I"}),Ct.removeUnderline=Xt("changeFormat",null,{tag:"U"}),Ct.removeStrikethrough=Xt("changeFormat",null,{tag:"S"}),Ct.removeSubscript=Xt("changeFormat",null,{tag:"SUB"}),Ct.removeSuperscript=Xt("changeFormat",null,{tag:"SUP"}),Ct.makeLink=function(e){var t=this.getSelection();if(t.collapsed){var n=e.indexOf(":")+1;if(n)for(;"/"===e[n];)n+=1;dt(t,this._doc.createTextNode(e.slice(n)))}return this.changeFormat({tag:"A",attributes:{href:e}},{tag:"A"},t),this.focus()},Ct.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},Ct.setFontFace=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"font",style:"font-family: "+e+", sans-serif;"}},{tag:"SPAN",attributes:{"class":"font"}}),this.focus()},Ct.setFontSize=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"size",style:"font-size: "+("number"==typeof e?e+"px":e)}},{tag:"SPAN",attributes:{"class":"size"}}),this.focus()},Ct.setTextColour=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"colour",style:"color: "+e}},{tag:"SPAN",attributes:{"class":"colour"}}),this.focus()},Ct.setHighlightColour=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"highlight",style:"background-color: "+e}},{tag:"SPAN",attributes:{"class":"highlight"}}),this.focus()},Ct.setTextAlignment=function(e){return this.forEachBlock(function(t){t.className=(t.className.split(/\s+/).filter(function(e){return!/align/.test(e)}).join(" ")+" align-"+e).trim(),t.style.textAlign=e},!0),this.focus()},Ct.setTextDirection=function(e){return this.forEachBlock(function(t){t.className=(t.className.split(/\s+/).filter(function(e){return!/dir/.test(e)}).join(" ")+" dir-"+e).trim(),t.dir=e},!0),this.focus()},Ct.increaseQuoteLevel=Xt("modifyBlocks",kt),Ct.decreaseQuoteLevel=Xt("modifyBlocks",bt),Ct.makeUnorderedList=Xt("modifyBlocks",Ot),Ct.makeOrderedList=Xt("modifyBlocks",xt),Ct.removeList=Xt("modifyBlocks",Lt),Ct.increaseListLevel=Xt("modifyBlocks",Dt),Ct.decreaseListLevel=Xt("modifyBlocks",It),top!==V?(V.editor=new b(e),V.onEditorLoad&&(V.onEditorLoad(V.editor),V.onEditorLoad=null)):V.Squire=b}(document); \ No newline at end of file +!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n}function r(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function o(e,t,n){if(e.nodeName!==t)return!1;for(var r in n)if(e.getAttribute(r)!==n[r])return!1;return!0}function i(e,t){return e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function a(e){return e.nodeType===L&&!!et[e.nodeName]}function s(e){return J.test(e.nodeName)}function d(e){return e.nodeType===L&&!s(e)&&r(e.childNodes,s)}function l(e){return e.nodeType===L&&!s(e)&&!d(e)}function c(e){var t=e.ownerDocument,r=new n(t.body,x,d,!1);return r.currentNode=e,r}function f(e){return c(e).previousNode()}function h(e){return c(e).nextNode()}function u(e,t,n){do if(o(e,t,n))return e;while(e=e.parentNode);return null}function p(e){var t,n,r,o,i=e.parentNode;return i&&e.nodeType===L?(t=p(i),t+=(t?">":"")+e.nodeName,(n=e.id)&&(t+="#"+n),(r=e.className.trim())&&(o=r.split(/\s\s*/),o.sort(),t+=".",t+=o.join("."))):t=i?p(i):"",t}function m(e){var t=e.nodeType;return t===L?e.childNodes.length:e.length||0}function g(e){var t=e.parentNode;return t&&t.removeChild(e),e}function v(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function N(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,r=n?n.length:0;r--;)t.appendChild(e.firstChild);return t}function S(e,n,r,o){var i,a,s,d,l=e.createElement(n);if(r instanceof Array&&(o=r,r=null),r)for(i in r)a=r[i],a!==t&&l.setAttribute(i,r[i]);if(o)for(s=0,d=o.length;d>s;s+=1)l.appendChild(o[s]);return l}function C(e){var t,n,r,o,i=e.ownerDocument,d=e;if("BODY"===e.nodeName&&((n=e.firstChild)&&"BR"!==n.nodeName||(t=i.createElement("DIV"),n?e.replaceChild(t,n):e.appendChild(t),e=t,t=null)),s(e)){for(n=e.firstChild;G&&n&&n.nodeType===R&&!n.data;)e.removeChild(n),n=e.firstChild;if(!n)if(G)for(t=i.createTextNode("​"),r=Nt.length;r--;)o=Nt[r],o._doc===i&&o._didAddZWS();else t=i.createTextNode("")}else if(q){for(;e.nodeType!==R&&!a(e);){if(n=e.firstChild,!n){t=i.createTextNode("");break}e=n}e.nodeType===R?/^ +$/.test(e.data)&&(e.data=""):a(e)&&e.parentNode.insertBefore(i.createTextNode(""),e)}else if(!e.querySelector("BR"))for(t=i.createElement("BR");(n=e.lastElementChild)&&!s(n);)e=n;return t&&e.appendChild(t),d}function _(e){var t,n,r,o,i=e.childNodes,a=e.ownerDocument,d=null;for(t=0,n=i.length;n>t;t+=1)r=i[t],o="BR"===r.nodeName,!o&&s(r)?(d||(d=S(a,"DIV")),d.appendChild(r),t-=1,n-=1):(o||d)&&(d||(d=S(a,"DIV")),C(d),o?e.replaceChild(d,r):(e.insertBefore(d,r),t+=1,n+=1),d=null),l(r)&&_(r);return d&&e.appendChild(C(d)),e}function y(e,t,n){var r,o,i,a=e.nodeType;if(a===R&&e!==n)return y(e.parentNode,e.splitText(t),n);if(a===L){if("number"==typeof t&&(t=td?t.startOffset-=1:t.startOffset===d&&(t.startContainer=r,t.startOffset=m(r))),t.endContainer===e&&(t.endOffset>d?t.endOffset-=1:t.endOffset===d&&(t.endContainer=r,t.endOffset=m(r))),g(n),n.nodeType===R?r.appendData(n.data):l.push(N(n));else if(n.nodeType===L){for(o=l.length;o--;)n.appendChild(l.pop());E(n,t)}}function T(e,t,n){for(var r,o,i,a=t;1===a.parentNode.childNodes.length;)a=a.parentNode;g(a),o=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),o-=1),i={startContainer:e,startOffset:o,endContainer:e,endOffset:o},e.appendChild(N(t)),E(e,i),n.setStart(i.startContainer,i.startOffset),n.collapse(!0),K&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}function B(e){var t,n,r=e.previousSibling,o=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if(!s||o&&/^[OU]L$/.test(o.nodeName))if(r&&i(r,e)){if(!l(r)){if(!s)return;n=a.createElement("DIV"),n.appendChild(N(r)),r.appendChild(n)}g(e),t=!l(e),r.appendChild(N(e)),t&&_(r),o&&B(o)}else s&&(r=a.createElement("DIV"),e.insertBefore(r,o),C(r))}function k(e){var n=e.defaultView,r=e.body;this._win=n,this._doc=e,this._body=r,this._events={},this._lastSelection=null,Q&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent),n.addEventListener("focus",this,!1),n.addEventListener("blur",this,!1),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this.defaultBlockProperties=t,this.addEventListener("keyup",this._docWasChanged),this._awaitingPaste=!1,this.addEventListener(W?"beforecut":"cut",this._onCut),this.addEventListener(W?"beforepaste":"paste",this._onPaste),M&&this.addEventListener("keyup",this._ieSelAllClean),this.addEventListener(K?"keypress":"keydown",this._onKey),$(e)&&(n.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,r=this.parentNode,o=this.length-e;return n?r.insertBefore(t,n):r.appendChild(t),o&&this.deleteData(e,o),t}),r.setAttribute("contenteditable","true"),this.setHTML("");try{e.execCommand("enableObjectResizing",!1,"false"),e.execCommand("enableInlineTableEditing",!1,"false")}catch(o){}Nt.push(this)}var b=2,L=1,R=3,x=1,A=4,D=0,O=1,I=2,P=3,U=e.defaultView,w=navigator.userAgent,F=/iP(?:ad|hone|od)/.test(w),H=/Mac OS X/.test(w),V=/Gecko\//.test(w),W=/Trident\/[456]\./.test(w),M=8===U.ie,K=!!U.opera,z=/WebKit\//.test(w),Z=H?"meta-":"ctrl-",q=W||K,G=W||z,Q=W,$=function(e){var t=e.createElement("DIV"),n=e.createTextNode("12");return t.appendChild(n),n.splitText(2),2!==t.childNodes.length},Y=/[^ \t\r\n]/,j=Array.prototype.indexOf,X={1:1,2:2,3:4,8:128,9:256,11:1024};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,r=this.nodeType,o=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)e=t.nextSibling,e||(t=t.parentNode);if(!e)return null;if(X[e.nodeType]&r&&o(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,r=this.nodeType,o=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(X[e.nodeType]&r&&o(e))return this.currentNode=e,e;t=e}};var J=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|FN|EL)|EM|FONT|HR|H1|I(?:NPUT|MG|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:U[BP]|PAN|TR(?:IKE|ONG)|MALL|AMP)?|U|VAR|WBR)$/,et={BR:1,IMG:1,INPUT:1},tt=function(e,t){for(var n=e.childNodes;t&&e.nodeType===L;)e=n[t-1],n=e.childNodes,t=n.length;return e},nt=function(e,t){if(e.nodeType===L){var n=e.childNodes;if(t-1,i=e.compareBoundaryPoints(O,r)<1;return!o&&!i}var a=e.compareBoundaryPoints(D,r)<1,s=e.compareBoundaryPoints(I,r)>-1;return a&&s},ct=function(e){for(var t,n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset;n.nodeType!==R&&(t=n.childNodes[r],t&&!a(t));)n=t,r=0;if(i)for(;o.nodeType!==R&&(t=o.childNodes[i-1],t&&!a(t));)o=t,i=m(o);else for(;o.nodeType!==R&&(t=o.firstChild,t&&!a(t));)o=t;e.collapsed?(e.setStart(o,i),e.setEnd(n,r)):(e.setStart(n,r),e.setEnd(o,i))},ft=function(e,t){var n,r=e.startContainer,o=e.startOffset,i=e.endContainer,a=e.endOffset;for(t||(t=e.commonAncestorContainer);r!==t&&!o;)n=r.parentNode,o=j.call(n.childNodes,r),r=n;for(;i!==t&&a===m(i);)n=i.parentNode,a=j.call(n.childNodes,i)+1,i=n;e.setStart(r,o),e.setEnd(i,a)},ht=function(e){var t,n=e.startContainer;return s(n)?t=f(n):d(n)?t=n:(t=tt(n,e.startOffset),t=h(t)),t&<(e,t,!0)?t:null},ut=function(e){var t,n,r=e.endContainer;if(s(r))t=f(r);else if(d(r))t=r;else{if(t=nt(r,e.endOffset),!t)for(t=r.ownerDocument.body;n=t.lastChild;)t=n;t=f(t)}return t&<(e,t,!0)?t:null},pt=new n(null,A|x,function(e){return e.nodeType===R?Y.test(e.data):"IMG"===e.nodeName}),mt=function(e){var t=e.startContainer,n=e.startOffset;if(t.nodeType===R){if(n)return!1;pt.currentNode=t}else pt.currentNode=nt(t,n);return pt.root=ht(e),!pt.previousNode()},gt=function(e){var t,n=e.endContainer,r=e.endOffset;if(n.nodeType===R){if(t=n.data.length,t&&t>r)return!1;pt.currentNode=n}else pt.currentNode=tt(n,r);return pt.root=ut(e),!pt.nextNode()},vt=function(e){var t,n=ht(e),r=ut(e);n&&r&&(t=n.parentNode,e.setStart(t,j.call(t.childNodes,n)),t=r.parentNode,e.setEnd(t,j.call(t.childNodes,r)+1))},Nt=[],St=k.prototype;St.createElement=function(e,t,n){return S(this._doc,e,t,n)},St.createDefaultBlock=function(e){return C(this.createElement("DIV",this.defaultBlockProperties,e))},St.didError=function(e){console.log(e)},St.getDocument=function(){return this._doc};var Ct={focus:1,blur:1,pathChange:1,select:1,input:1,undoStateChange:1};St.fireEvent=function(e,t){var n,r,o,i=this._events[e];if(i)for(t||(t={}),t.type!==e&&(t.type=e),i=i.slice(),n=0,r=i.length;r>n;n+=1){o=i[n];try{o.handleEvent?o.handleEvent(t):o.call(this,t)}catch(a){a.details="Squire: fireEvent error. Event type: "+e,this.didError(a)}}return this},St.destroy=function(){var e,t=this._win,n=this._doc,r=this._events;t.removeEventListener("focus",this,!1),t.removeEventListener("blur",this,!1);for(e in r)Ct[e]||n.removeEventListener(e,this,!0);for(var o=Nt.length;o--;)Nt[o]===this&&Nt.splice(o,1)},St.handleEvent=function(e){this.fireEvent(e.type,e)},St.addEventListener=function(e,t){var n=this._events[e];return t?(n||(n=this._events[e]=[],Ct[e]||this._doc.addEventListener(e,this,!0)),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},St.removeEventListener=function(e,t){var n,r=this._events[e];if(r){for(n=r.length;n--;)r[n]===t&&r.splice(n,1);r.length||(delete this._events[e],Ct[e]||this._doc.removeEventListener(e,this,!1))}return this},St._createRange=function(e,t,n,r){if(e instanceof this._win.Range)return e.cloneRange();var o=this._doc.createRange();return o.setStart(e,t),n?o.setEnd(n,r):o.setEnd(e,t),o},St.setSelection=function(e){if(e){F&&this._win.focus();var t=this._win.getSelection();t.removeAllRanges(),t.addRange(e)}return this},St.getSelection=function(){var e,t,n,r=this._win.getSelection();if(r.rangeCount){e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer;try{t&&a(t)&&e.setStartBefore(t),n&&a(n)&&e.setEndBefore(n)}catch(o){this.didError({name:"Squire#getSelection error",message:"Starts: "+t.nodeName+"\nEnds: "+n.nodeName})}this._lastSelection=e}else e=this._lastSelection;return e||(e=this._createRange(this._body.firstChild,0)),e},St.getSelectedText=function(){return ot(this.getSelection())},St.getPath=function(){return this._path},St._didAddZWS=function(){this._hasZWS=!0},St._removeZWS=function(){if(this._hasZWS){for(var e,t,r=new n(this._body,A,function(){return!0},!1);e=r.nextNode();)for(;(t=e.data.indexOf("​"))>-1;)e.deleteData(t,1);this._hasZWS=!1}},St._updatePath=function(e,t){var n,r=e.startContainer,o=e.endContainer;(t||r!==this._lastAnchorNode||o!==this._lastFocusNode)&&(this._lastAnchorNode=r,this._lastFocusNode=o,n=r&&o?r===o?p(o):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),r!==o&&this.fireEvent("select")},St._updatePathOnEvent=function(){this._updatePath(this.getSelection())},St.focus=function(){return this._body.focus(),this._win.focus(),this},St.blur=function(){return V&&this._body.blur(),top.focus(),this};var _t="squire-selection-start",yt="squire-selection-end";St._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:_t,type:"hidden"}),r=this.createElement("INPUT",{id:yt,type:"hidden"});it(e,n),e.collapse(!1),it(e,r),n.compareDocumentPosition(r)&b&&(n.id=yt,r.id=_t,t=n,n=r,r=t),e.setStartAfter(n),e.setEndBefore(r)},St._getRangeAndRemoveBookmark=function(e){var t=this._doc,n=t.getElementById(_t),r=t.getElementById(yt);if(n&&r){var o,i=n.parentNode,a=r.parentNode,s={startContainer:i,endContainer:a,startOffset:j.call(i.childNodes,n),endOffset:j.call(a.childNodes,r)};i===a&&(s.endOffset-=1),g(n),g(r),E(i,s),i!==a&&E(a,s),e||(e=t.createRange()),e.setStart(s.startContainer,s.startOffset),e.setEnd(s.endContainer,s.endOffset),o=e.collapsed,ct(e),o&&e.collapse(!0)}return e||null},St._docWasChanged=function(e){var t=e&&e.keyCode;(!e||!e.ctrlKey&&!e.metaKey&&!e.altKey&&(16>t||t>20)&&(33>t||t>45))&&(this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input"))},St._recordUndoState=function(e){if(!this._isInUndoState){var t=this._undoIndex+=1,n=this._undoStack;te+1&&this._isInUndoState){this._undoIndex+=1,this._setHTML(this._undoStack[this._undoIndex]);var n=this._getRangeAndRemoveBookmark();n&&this.setSelection(n),this.fireEvent("undoStateChange",{canUndo:!0,canRedo:t>e+2}),this.fireEvent("input")}return this},St.hasFormat=function(e,t,r){if(e=e.toUpperCase(),t||(t={}),!r&&!(r=this.getSelection()))return!1;var o,i,a=r.commonAncestorContainer;if(u(a,e,t))return!0;if(a.nodeType===R)return!1;o=new n(a,A,function(e){return lt(r,e,!0)},!1);for(var s=!1;i=o.nextNode();){if(!u(i,e,t))return!1;s=!0}return s},St._addFormat=function(e,t,r){var o,i,a,s,d,l,c,f;if(r.collapsed)o=C(this.createElement(e,t)),it(r,o),r.setStart(o.firstChild,o.firstChild.length),r.collapse(!0);else{i=new n(r.commonAncestorContainer,A,function(e){return lt(r,e,!0)},!1),a=r.startContainer,d=r.startOffset,s=r.endContainer,l=r.endOffset,i.currentNode=a,a.nodeType!==R&&(a=i.nextNode(),d=0);do c=i.currentNode,f=!u(c,e,t),f&&(c===s&&c.length>l&&c.splitText(l),c===a&&d&&(c=c.splitText(d),s===a&&(s=c,l-=d),a=c,d=0),o=this.createElement(e,t),v(c,o),o.appendChild(c));while(i.nextNode());s.nodeType!==R&&(s=c,l=c.length),r=this._createRange(a,d,s,l)}return r},St._removeFormat=function(e,t,n,r){this._saveRangeToBookmark(n);var i,a=this._doc;n.collapsed&&(G?(i=a.createTextNode("​"),this._didAddZWS()):i=a.createTextNode(""),it(n,i));for(var d=n.commonAncestorContainer;s(d);)d=d.parentNode;var l=n.startContainer,c=n.startOffset,f=n.endContainer,h=n.endOffset,u=[],p=function(e,t){if(!lt(n,e,!1)){var r,o,i=e.nodeType===R;if(!lt(n,e,!0))return void("INPUT"===e.nodeName||i&&!e.data||u.push([t,e]));if(i)e===f&&h!==e.length&&u.push([t,e.splitText(h)]),e===l&&c&&(e.splitText(c),u.push([t,e]));else for(r=e.firstChild;r;r=o)o=r.nextSibling,p(r,t)}},m=Array.prototype.filter.call(d.getElementsByTagName(e),function(r){return lt(n,r,!0)&&o(r,e,t)});r||m.forEach(function(e){p(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];v(n,t),t.appendChild(n)}),m.forEach(function(e){v(e,N(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1);var g={startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset};return E(d,g),n.setStart(g.startContainer,g.startOffset),n.setEnd(g.endContainer,g.endOffset),n},St.changeFormat=function(e,t,n,r){return n||(n=this.getSelection())?(this._recordUndoState(n),this._getRangeAndRemoveBookmark(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,r)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),this._docWasChanged(),this):void 0};var Et={DIV:"DIV",PRE:"DIV",H1:"DIV",H2:"DIV",H3:"DIV",H4:"DIV",H5:"DIV",H6:"DIV",P:"DIV",DT:"DD",DD:"DT",LI:"LI"},Tt=function(e,t,n){var r=Et[e.nodeName],o=y(t,n,e.parentNode);return o.nodeName!==r&&(e=S(o.ownerDocument,r),e.className="rtl"===o.dir?"dir-rtl":"",e.dir=o.dir,v(o,e),e.appendChild(N(o)),o=e),o};St.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&(this._recordUndoState(n),this._getRangeAndRemoveBookmark(n));var r=ht(n),o=ut(n);if(r&&o)do if(e(r)||r===o)break;while(r=h(r));return t&&(this.setSelection(n),this._updatePath(n,!0),this._docWasChanged()),this},St.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._isInUndoState?this._saveRangeToBookmark(t):this._recordUndoState(t),vt(t);var n,r=this._body;return ft(t,r),n=at(t,r),it(t,e.call(this,n)),t.endOffsett;t+=1){for(o=d[t],i=N(o),a=i.childNodes,r=a.length;r--;)s=a[r],v(s,N(s));_(i),v(o,i)}return e},Dt=function(e){var t,n,r,o,i,a=e.querySelectorAll("LI");for(t=0,n=a.length;n>t;t+=1)r=a[t],l(r.firstChild)||(o=r.parentNode.nodeName,i=r.previousSibling,i&&(i=i.lastChild)&&i.nodeName===o||v(r,this.createElement("LI",[i=this.createElement(o)])),i.appendChild(r));return e},Ot=function(e){var t=e.querySelectorAll("LI");return Array.prototype.filter.call(t,function(e){return!l(e.firstChild)}).forEach(function(t){var n,r=t.parentNode,o=r.parentNode,i=t.firstChild,a=i;for(t.previousSibling&&(r=y(r,t,o));a&&(n=a.nextSibling,!l(a));)o.insertBefore(a,r),a=n;for("LI"===o.nodeName&&i.previousSibling&&y(o,i,o.parentNode);t!==e&&!t.childNodes.length;)r=t.parentNode,r.removeChild(t),t=r},this),_(e),e},It=/\b((?:(?:ht|f)tps?:\/\/|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,}\/)(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)/i,Pt=function(e){for(var t,r,o,i,a,s,d,l=e.ownerDocument,c=new n(e,A,function(e){return!u(e,"A")},!1);t=c.nextNode();)for(r=t.data,o=t.parentNode;i=It.exec(r);)a=i.index,s=a+i[0].length,a&&(d=l.createTextNode(r.slice(0,a)),o.insertBefore(d,t)),d=l.createElement("A"),d.textContent=r.slice(a,s),d.href=i[1]?/^(?:ht|f)tps?:/.test(i[1])?i[1]:"http://"+i[1]:"mailto:"+i[2],o.insertBefore(d,t),t.data=r=r.slice(s)},Ut=/^(?:A(?:DDRESS|RTICLE|SIDE)|BLOCKQUOTE|CAPTION|D(?:[DLT]|IV)|F(?:IGURE|OOTER)|H[1-6]|HEADER|L(?:ABEL|EGEND|I)|O(?:L|UTPUT)|P(?:RE)?|SECTION|T(?:ABLE|BODY|D|FOOT|H|HEAD|R)|UL)$/,wt={1:10,2:13,3:16,4:18,5:24,6:32,7:48},Ft={backgroundColor:{regexp:Y,replace:function(e,t){return S(e,"SPAN",{"class":"highlight",style:"background-color: "+t})}},color:{regexp:Y,replace:function(e,t){return S(e,"SPAN",{"class":"colour",style:"color:"+t})}},fontWeight:{regexp:/^bold/i,replace:function(e){return S(e,"B")}},fontStyle:{regexp:/^italic/i,replace:function(e){return S(e,"I")}},fontFamily:{regexp:Y,replace:function(e,t){return S(e,"SPAN",{"class":"font",style:"font-family:"+t})}},fontSize:{regexp:Y,replace:function(e,t){return S(e,"SPAN",{"class":"size",style:"font-size:"+t})}}},Ht=function(e){return function(t,n){var r=S(t.ownerDocument,e);return n.replaceChild(r,t),r.appendChild(N(t)),r}},Vt={SPAN:function(e,t){var n,r,o,i,a,s,d=e.style,l=e.ownerDocument;for(n in Ft)r=Ft[n],o=d[n],o&&r.regexp.test(o)&&(s=r.replace(l,o),i&&i.appendChild(s),i=s,a||(a=s));return a&&(i.appendChild(N(e)),t.replaceChild(a,e)),i||e},STRONG:Ht("B"),EM:Ht("I"),STRIKE:Ht("S"),FONT:function(e,t){var n,r,o,i,a,s=e.face,d=e.size,l=e.color,c=e.ownerDocument;return s&&(n=S(c,"SPAN",{"class":"font",style:"font-family:"+s}),a=n,i=n),d&&(r=S(c,"SPAN",{"class":"size",style:"font-size:"+wt[d]+"px"}),a||(a=r),i&&i.appendChild(r),i=r),l&&/^#?([\dA-F]{3}){1,2}$/i.test(l)&&("#"!==l.charAt(0)&&(l="#"+l),o=S(c,"SPAN",{"class":"colour",style:"color:"+l}),a||(a=o),i&&i.appendChild(o),i=o),a||(a=i=S(c,"SPAN")),t.replaceChild(a,e),i.appendChild(N(e)),i},TT:function(e,t){var n=S(e.ownerDocument,"SPAN",{"class":"font",style:'font-family:menlo,consolas,"courier new",monospace'});return t.replaceChild(n,e),n.appendChild(N(e)),n}},Wt=function(e){for(var t,n=e.childNodes,r=n.length;r--;)t=n[r],t.nodeType===L&&"IMG"!==t.nodeName&&(Wt(t),s(t)&&!t.firstChild&&e.removeChild(t))},Mt=function(e,t){var n,r,o,i,a,d,l,c,f,h,u=e.childNodes;for(n=0,r=u.length;r>n;n+=1)if(o=u[n],i=o.nodeName,a=o.nodeType,d=Vt[i],a===L){if(l=o.childNodes.length,d)o=d(o,e);else{if(!Ut.test(i)&&!s(o)){n-=1,r+=l-1,e.replaceChild(N(o),o);continue}!t&&o.style.cssText&&o.removeAttribute("style")}l&&Mt(o,t)}else{if(a===R){if(c=o.data,/\S/.test(c)){if(s(e))continue;if(f=0,h=c.length,!n||!s(u[n-1])){for(;h>f&&!Y.test(c.charAt(f));)f+=1;f&&(o.data=c=c.slice(f),h-=f)}if(n+1===r||!s(u[n+1])){for(f=h;f>0&&!Y.test(c.charAt(f-1));)f-=1;h>f&&(o.data=c.slice(0,f))}continue}if(n&&r>n+1&&s(u[n-1])&&s(u[n+1])){o.data=" ";continue}}e.removeChild(o),n-=1,r-=1}return e},Kt=function(e){return e.nodeType===L?"BR"===e.nodeName:Y.test(e.data)},zt=function(e){for(var t,r=e.parentNode;s(r);)r=r.parentNode;return t=new n(r,x|A,Kt),t.currentNode=e,!!t.nextNode()},Zt=function(e){var t,n,r,o=e.querySelectorAll("BR"),i=[],a=o.length;for(t=0;a>t;t+=1)i[t]=zt(o[t]);for(;a--;)if(n=o[a],r=n.parentNode){for(;s(r);)r=r.parentNode;if(d(r)){if(i[a]){if("DIV"!==r.nodeName)continue;y(n.parentNode,n,r.parentNode)}g(n)}else _(r)}};St._ensureBottomLine=function(){var e=this._body,t=e.lastChild;t&&"DIV"===t.nodeName&&d(t)||e.appendChild(this.createDefaultBlock())},St._onCut=function(){var e=this.getSelection(),t=this;this._recordUndoState(e),this._getRangeAndRemoveBookmark(e),this.setSelection(e),setTimeout(function(){try{t._ensureBottomLine()}catch(e){t.didError(e)}},0)},St._onPaste=function(e){if(!this._awaitingPaste){var t,n,r=e.clipboardData,o=r&&r.items,i=!1,a=!1;if(o){for(t=o.length;t--;){if(n=o[t].type,"text/html"===n){a=!1;break}/^image\/.*/.test(n)&&(a=!0)}if(a)return e.preventDefault(),this.fireEvent("dragover",{dataTransfer:r,preventDefault:function(){i=!0}}),void(i&&this.fireEvent("drop",{dataTransfer:r}))}this._awaitingPaste=!0;var s=this,d=this._body,l=this.getSelection(),c=l.startContainer,f=l.startOffset,u=l.endContainer,p=l.endOffset,m=ht(l);s._recordUndoState(l),s._getRangeAndRemoveBookmark(l);var v=this.createElement("DIV",{style:"position: absolute; overflow: hidden; top:"+(d.scrollTop+(m?m.getBoundingClientRect().top:0))+"px; left: 0; width: 1px; height: 1px;"});d.appendChild(v),l.selectNodeContents(v),this.setSelection(l),setTimeout(function(){try{var e=N(g(v)),t=e.firstChild,n=s._createRange(c,f,u,p);if(t){t===e.lastChild&&"DIV"===t.nodeName&&e.replaceChild(N(t),t),e.normalize(),Pt(e),Mt(e,!1),Zt(e),Wt(e);for(var r=e,o=!0;r=h(r);)C(r);s.fireEvent("willPaste",{fragment:e,preventDefault:function(){o=!1}}),o&&(dt(n,e),s._docWasChanged(),n.collapse(!1),s._ensureBottomLine())}s.setSelection(n),s._updatePath(n,!0),s._awaitingPaste=!1}catch(i){s.didError(i)}},0)}};var qt={8:"backspace",9:"tab",13:"enter",32:"space",37:"left",39:"right",46:"delete",219:"[",221:"]"},Gt=function(e){return function(t,n){n.preventDefault(),t[e]()}},Qt=function(e,t){return t=t||null,function(n,r){r.preventDefault();var o=n.getSelection();n.hasFormat(e,null,o)?n.changeFormat(null,{tag:e},o):n.changeFormat({tag:e},t,o)}},$t=function(e){try{var t,n=e.getSelection(),r=n.startContainer;if(r.nodeType===R&&(r=r.parentNode),s(r)&&!r.textContent){do t=r.parentNode;while(s(t)&&!t.textContent&&(r=t));n.setStart(t,j.call(t.childNodes,r)),n.collapse(!0),t.removeChild(r),d(t)||(t=f(t)),C(t),ct(n),e.setSelection(n),e._updatePath(n)}e._ensureBottomLine()}catch(o){e.didError(o)}};M&&(St._ieSelAllClean=function(){var e=this._body.firstChild;"P"===e.nodeName&&(this._saveRangeToBookmark(this.getSelection()),v(e,this.createDefaultBlock([N(e)])),this.setSelection(this._getRangeAndRemoveBookmark()))});var Yt={enter:function(e,t){t.preventDefault();var n,r,o,i,a,s=e.getSelection();if(s){if(e._recordUndoState(s),Pt(s.startContainer),e._removeZWS(),e._getRangeAndRemoveBookmark(s),s.collapsed||st(s),n=ht(s),n&&(r=u(n,"LI"))&&(n=r),o=n?n.nodeName:"DIV",i=Et[o],!n)return it(s,e.createElement("BR")),s.collapse(!1),e.setSelection(s),e._updatePath(s,!0),void e._docWasChanged();var d,l=s.startContainer,c=s.startOffset;if(i||(l===n&&(l=c?l.childNodes[c-1]:null,c=0,l&&("BR"===l.nodeName?l=l.nextSibling:c=m(l),l&&"BR"!==l.nodeName||(d=C(e.createElement("DIV")),l?n.replaceChild(d,l):n.appendChild(d),l=d))),_(n),i="DIV",l||(l=n.firstChild),s.setStart(l,c),s.setEnd(l,c),n=ht(s)),!n.textContent){if(u(n,"UL")||u(n,"OL"))return e.modifyBlocks(Ot,s);if(u(n,"BLOCKQUOTE"))return e.modifyBlocks(bt,s)}for(a=Tt(n,l,c);a.nodeType===L;){var f,h=a.firstChild;if("A"!==a.nodeName){for(;h&&h.nodeType===R&&!h.data&&(f=h.nextSibling,f&&"BR"!==f.nodeName);)g(h),h=f;if(!h||"BR"===h.nodeName||h.nodeType===R&&!K)break;a=h}else v(a,N(a)),a=h}s=e._createRange(a,0),e.setSelection(s),e._updatePath(s,!0),a.nodeType===R&&(a=a.parentNode);var p=e._doc,S=e._body;a.offsetTop+a.offsetHeight>(p.documentElement.scrollTop||S.scrollTop)+S.offsetHeight&&a.scrollIntoView(!1),e._docWasChanged()}},backspace:function(e,t){e._removeZWS();var n=e.getSelection();if(e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),n.collapsed)if(mt(n)){t.preventDefault();var r=ht(n),o=r&&f(r);if(o){if(!o.isContentEditable)return void g(o);for(T(o,r,n),r=o.parentNode;r&&!r.nextSibling;)r=r.parentNode;r&&(r=r.nextSibling)&&B(r),e.setSelection(n)}else if(r){if(u(r,"UL")||u(r,"OL"))return e.modifyBlocks(Ot,n);if(u(r,"BLOCKQUOTE"))return e.modifyBlocks(kt,n);e.setSelection(n),e._updatePath(n,!0)}}else e.setSelection(n),setTimeout(function(){$t(e)},0);else t.preventDefault(),st(n),e._ensureBottomLine(),e.setSelection(n),e._updatePath(n,!0)},"delete":function(e,t){e._removeZWS();var n=e.getSelection();if(e._recordUndoState(n),e._getRangeAndRemoveBookmark(n),n.collapsed)if(gt(n)){t.preventDefault();var r=ht(n),o=r&&h(r);if(o){if(!o.isContentEditable)return void g(o);for(T(r,o,n),o=r.parentNode;o&&!o.nextSibling;)o=o.parentNode;o&&(o=o.nextSibling)&&B(o),e.setSelection(n),e._updatePath(n,!0)}}else e.setSelection(n),setTimeout(function(){$t(e)},0);else t.preventDefault(),st(n),e._ensureBottomLine(),e.setSelection(n),e._updatePath(n,!0)},tab:function(e,t){e._removeZWS();var n,r,o=e.getSelection();if(o.collapsed&&mt(o)&>(o)){for(n=ht(o);r=n.parentNode;){if("UL"===r.nodeName||"OL"===r.nodeName){n.previousSibling&&(t.preventDefault(),e.modifyBlocks(Dt,o));break}n=r}t.preventDefault()}},space:function(e){var t=e.getSelection();e._recordUndoState(t),Pt(t.startContainer),e._getRangeAndRemoveBookmark(t),e.setSelection(t)},left:function(e){e._removeZWS()},right:function(e){e._removeZWS()}};H&&V&&U.getSelection().modify&&(Yt["meta-left"]=function(e,t){t.preventDefault(),e._win.getSelection().modify("move","backward","lineboundary")},Yt["meta-right"]=function(e,t){t.preventDefault(),e._win.getSelection().modify("move","forward","lineboundary")}),Yt[Z+"b"]=Qt("B"),Yt[Z+"i"]=Qt("I"),Yt[Z+"u"]=Qt("U"),Yt[Z+"shift-7"]=Qt("S"),Yt[Z+"shift-5"]=Qt("SUB",{tag:"SUP"}),Yt[Z+"shift-6"]=Qt("SUP",{tag:"SUB"}),Yt[Z+"shift-8"]=Gt("makeUnorderedList"),Yt[Z+"shift-9"]=Gt("makeOrderedList"),Yt[Z+"["]=Gt("decreaseQuoteLevel"),Yt[Z+"]"]=Gt("increaseQuoteLevel"),Yt[Z+"y"]=Gt("redo"),Yt[Z+"z"]=Gt("undo"),Yt[Z+"shift-z"]=Gt("redo"),St._onKey=function(e){var t=e.keyCode,n=qt[t],r="";n||(n=String.fromCharCode(t).toLowerCase(),/^[A-Za-z0-9]$/.test(n)||(n="")),K&&46===e.which&&(n="."),t>111&&124>t&&(n="f"+(t-111)),"backspace"!==n&&"delete"!==n&&(e.altKey&&(r+="alt-"),e.ctrlKey&&(r+="ctrl-"),e.metaKey&&(r+="meta-")),e.shiftKey&&(r+="shift-"),n=r+n,Yt[n]&&Yt[n](this,e)},St._getHTML=function(){return this._body.innerHTML},St._setHTML=function(e){var t=this._body;t.innerHTML=e;do C(t);while(t=h(t))},St.getHTML=function(e){var t,n,r,o,i,a=[];if(e&&(i=this.getSelection())&&this._saveRangeToBookmark(i),q)for(t=this._body;t=h(t);)t.textContent||t.querySelector("BR")||(n=this.createElement("BR"),t.appendChild(n),a.push(n));if(r=this._getHTML().replace(/\u200B/g,""),q)for(o=a.length;o--;)g(a[o]);return i&&this._getRangeAndRemoveBookmark(i),r},St.setHTML=function(e){var t,n=this._doc.createDocumentFragment(),r=this.createElement("DIV");r.innerHTML=e,n.appendChild(N(r)),Mt(n,!0),Zt(n),_(n);for(var o=n;o=h(o);)C(o);for(var i=this._body;t=i.lastChild;)i.removeChild(t);i.appendChild(n),C(i),this._undoIndex=-1,this._undoStack.length=0,this._undoStackLength=0,this._isInUndoState=!1;var a=this._getRangeAndRemoveBookmark()||this._createRange(i.firstChild,0); +return this._recordUndoState(a),this._getRangeAndRemoveBookmark(a),Q?this._lastSelection=a:this.setSelection(a),this._updatePath(a,!0),this},St.insertElement=function(e,t){if(t||(t=this.getSelection()),t.collapse(!0),s(e))it(t,e),t.setStartAfter(e);else{for(var n,r,o=this._body,i=ht(t)||o;i!==o&&!i.nextSibling;)i=i.parentNode;i!==o&&(n=i.parentNode,r=y(n,i.nextSibling,o)),r?(o.insertBefore(e,r),t.setStart(r,0),t.setStart(r,0),ct(t)):(o.appendChild(e),o.appendChild(this.createDefaultBlock()),t.setStart(e,0),t.setEnd(e,0)),this.focus(),this.setSelection(t),this._updatePath(t)}return this},St.insertImage=function(e){var t=this.createElement("IMG",{src:e});return this.insertElement(t),t};var jt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};St.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.styleSheet?(t.appendChild(n),n.styleSheet.cssText=e):(n.appendChild(this._doc.createTextNode(e)),t.appendChild(n))}return this},St.bold=jt("changeFormat",{tag:"B"}),St.italic=jt("changeFormat",{tag:"I"}),St.underline=jt("changeFormat",{tag:"U"}),St.strikethrough=jt("changeFormat",{tag:"S"}),St.subscript=jt("changeFormat",{tag:"SUB"},{tag:"SUP"}),St.superscript=jt("changeFormat",{tag:"SUP"},{tag:"SUB"}),St.removeBold=jt("changeFormat",null,{tag:"B"}),St.removeItalic=jt("changeFormat",null,{tag:"I"}),St.removeUnderline=jt("changeFormat",null,{tag:"U"}),St.removeStrikethrough=jt("changeFormat",null,{tag:"S"}),St.removeSubscript=jt("changeFormat",null,{tag:"SUB"}),St.removeSuperscript=jt("changeFormat",null,{tag:"SUP"}),St.makeLink=function(e){var t=this.getSelection();if(t.collapsed){var n=e.indexOf(":")+1;if(n)for(;"/"===e[n];)n+=1;it(t,this._doc.createTextNode(e.slice(n)))}return this.changeFormat({tag:"A",attributes:{href:e}},{tag:"A"},t),this.focus()},St.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},St.setFontFace=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"font",style:"font-family: "+e+", sans-serif;"}},{tag:"SPAN",attributes:{"class":"font"}}),this.focus()},St.setFontSize=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"size",style:"font-size: "+("number"==typeof e?e+"px":e)}},{tag:"SPAN",attributes:{"class":"size"}}),this.focus()},St.setTextColour=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"colour",style:"color: "+e}},{tag:"SPAN",attributes:{"class":"colour"}}),this.focus()},St.setHighlightColour=function(e){return this.changeFormat({tag:"SPAN",attributes:{"class":"highlight",style:"background-color: "+e}},{tag:"SPAN",attributes:{"class":"highlight"}}),this.focus()},St.setTextAlignment=function(e){return this.forEachBlock(function(t){t.className=(t.className.split(/\s+/).filter(function(e){return!/align/.test(e)}).join(" ")+" align-"+e).trim(),t.style.textAlign=e},!0),this.focus()},St.setTextDirection=function(e){return this.forEachBlock(function(t){t.className=(t.className.split(/\s+/).filter(function(e){return!/dir/.test(e)}).join(" ")+" dir-"+e).trim(),t.dir=e},!0),this.focus()},St.makeHeading=function(){var e=this.getSelection();return this.changeFormat({tag:"H1"},null,e),this.focus()},St.removeHeading=function(){var e=this.getSelection();return this.changeFormat(null,{tag:"H1",attributes:{}},e,!1),this.focus()},St.increaseQuoteLevel=jt("modifyBlocks",Bt),St.decreaseQuoteLevel=jt("modifyBlocks",kt),St.makeUnorderedList=jt("modifyBlocks",Rt),St.makeOrderedList=jt("modifyBlocks",xt),St.removeList=jt("modifyBlocks",At),St.increaseListLevel=jt("modifyBlocks",Dt),St.decreaseListLevel=jt("modifyBlocks",Ot),top!==U?(U.editor=new k(e),U.onEditorLoad&&(U.onEditorLoad(U.editor),U.onEditorLoad=null)):U.Squire=k}(document); \ No newline at end of file