Disabled and moved unnecessary functions if not logged in and not on frontend
+
Added unsaved changes warning if leaving page
+
+
0.1.2
+
+
Removed submodule link of plugin updater
+
0.1.1
Added updating functionality through github, curtesy of YahnisElsts, as well as automatic background updates
diff --git a/CHANGELOG.md b/CHANGELOG.md
index baf1ee0..ff56fd3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
CHANGELOG
=========
+## 0.2
+* Added support for featured image
+* Disabled and moved unnecessary functions if not logged in and not on frontend
+* Added unsaved changes warning if leaving page
+
+## 0.1.2
+* Removed submodule link of plugin updater
+
## 0.1.1
* Added updating functionality through github, curtesy of [YahnisElsts](https://github.com/YahnisElsts/plugin-update-checker), as well as automatic background updates
* Added oEmbed support (automatic conversion of valid oEmbed)
diff --git a/README.html b/README.html
index 5f83b38..66b9e87 100644
--- a/README.html
+++ b/README.html
@@ -8,6 +8,7 @@
WA Fronted WordPress Plugin
+
Configuration
To enable an editable area, simply add a filter function to 'wa_fronted_options' that passes and returns a multidimensional array. Note that both themes and plugins can call this filter before or after eachother and build upon or replace options.
The first level of the array consists of the key "defaults" (optional) and "post_types". In "defaults", specify whatever you want to be set as default when you have not set anything else in that specific area. In "post_types" you create an array for each post type you want to enable frontend editing for (you can also use 'front_page' if you just want to target your static front page). Inside, you set "editable_areas" with an array with options for each editable area on this post type.
The following example will enable the regular post content on front page to be editable from frontend if logged in user has role "administrator", with a toolbar consisting of only bold and italic buttons, but on posts we allow a full toolbar and leaving permission to the default (current_user_can('edit_posts')).
@@ -49,12 +50,13 @@
WA Fronted WordPress Plugin
Options
container (required, string): selector of wrapping element of what you want to edit. Can be any valid jQuery selector string
-
field_type (required, string): post_content, post_title, acf_{FIELD ID} / acf_sub_{SUBFIELD ID} (if set and toolbar is not specified, toolbar will set itself based on what field it is)
+
field_type (required, string): post_content, post_title, post_thumbnail (note that if you don't use thepost_thumbnail() function, the image has to have the class 'attachment-post-thumbnail'), `acf{FIELD ID}/acfsub{SUBFIELD ID}` (if set and toolbar is not specified, toolbar will set itself based on what field it is)
permission (optional, string): logged-in (enable to all logged in users), default (default, enabled if user has capability edit_posts), {USER ROLE} (enable to specific user role)
post_id (optional, int): Insert post id to override the global $post variable. If used in combination with acf_{FIELD ID}, note that it can also be set to options / taxonomies / users / etc
toolbar (optional, mixed bool/string): full (default, all buttons), false (do not show toolbar), comma-separated string (bold, italic, underline, anchor, header1, header2, quote, unorderedlist, orderedlist, justifyLeft, justifyCenter, justifyRight)
media_upload (optional, mixed bool/string): true (default, will allow user to insert/upload media to the editable area), false (disable media upload), only (constrain the editable area to only edit media. ie; no text, no toolbar)
-
output (optional, string): only applies to ACF fields with complex output value to retrieve from get_field() to output as a dot separated string representing the traversing of value array, ie. for an image field that should output the thumbnail: "sizes.thumbnail".
+
image_size (optional, string): any registered image size (only applicable if field_type is set and you want another image size than WP default, which is 'post-thumbnail')
+
output (optional, string): alue to retrieve from get_field() to output as a dot separated string representing the traversing of value array, ie. for an image field that should output the thumbnail: "sizes.thumbnail" (only applicable to ACF fields with complex output)
output_to (optional, array): if not specified, the returned data after save will be put directly into the container element
array(
"selector" => (string) selector of element inside **container** to output content to. Can be any valid jQuery selector string,
"attr" => (mixed bool/string) if output should be set to an attribute of **selector**, otherwise false or not set
@@ -69,6 +71,7 @@
Action hooks
wa_after_fronted_scripts runs after plugin has registered all its scripts and styles (passes complete options array as argument)
wa_fronted_save runs after regular save function (passes $data as argument)
wa_fronted_autosave runs after regular autosave function (passes $data as argument)
+
wa_fronted_toolbar runs when bottom toolbar renders (before ending ) (passes complete options array as argument)
I'll try to add hooks where I see it could be useful, but if you are missing one, please post an issue requesting it
Filters
@@ -91,17 +94,23 @@
Supported ACF field types
Image
File
-
Pending features
+
Features
-
These are features that are planned to be implemented in the near future (in no particular order)
+
Unchecked boxes are features that are planned to be implemented in the near future (in no particular order)
-
[ ] Ability to edit featured image
-
[ ] Show unsaved changes warning if leaving page
-
[ ] Ability to edit other columns from the posts table (like post_author, post_date and so on)
+
[x] Automatic changing of image size to load when changing size of image in content
+
[x] Gallery shortcode editing
+
[x] Advanced Custom Fields support (see supported ACF fields for more details)
+
[x] Automatic oEmbed conversion upon paste
+
[x] Automatic url to link conversion
+
[x] Automatic updates
+
[x] Ability to edit featured image
+
[x] Show unsaved changes warning if leaving page
+
[ ] Ability to edit other columns from the posts table (like post_author, post_date, post_status and so on)
[ ] Native custom fields support
[ ] Shortcodes support (other than gallery)
-
[ ] Autosave
+
[ ] Autosave (need some discussion on how to best implement this)
[ ] WooCommerce support (other than standard WP-fields)
[ ] Image upload by dropping an image into the editable area
[ ] Drag image to move it within the editable area
@@ -110,23 +119,25 @@
Pending features
[ ] Choice-based fields like dropdown-select (click on content to show dropdown and select option to insert)
[ ] More ACF fields support
[ ] Smarter outputting of value (like if it's an image field and has no output options, determine by itself)
-
[ ] Enable editing from archives/blog home
[ ] Post revisions
[ ] Edit taxonomies (and native tags and categories)
-
[ ] Make it possible to create new posts from frontend
[ ] How-to guide for integration and extensions
-
[x] oEmbed support in wysiwyg
-
[x] Updates
-
[x] Automatic updates
+
[ ] Translation
+
[ ] Mirror style of current WP admin theme
Proposed features
These features requires further discussion, not yet set to be implemented
-
[ ] Spellchecking and wordsuggestion, autocorrection
+
[ ] Enhance UX by visualizing which area you are editing
+
[ ] Make it possible to create new posts from frontend
+
[ ] Change common ajax functions to make use of WP Rest API instead (when implemented into core)
+
[ ] Spellchecking and word suggestion, auto correction
[ ] Ability to update widget contents
-
[ ] Column-maker
+
[ ] Editing from archives/blog home
+
[ ] Markdown parser
+
[ ] Column-maker (made as an add-on?)
Collaboration notes
diff --git a/README.md b/README.md
index c490e9b..917b0cf 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Frontend editor for WordPress, an experiment with a goal to enhance usability an
![](https://github.com/jesperbjerke/wa-fronted/blob/master/screenshots/screenshot-2.jpg)
![](https://github.com/jesperbjerke/wa-fronted/blob/master/screenshots/screenshot-3.jpg)
+##Configuration
To enable an editable area, simply add a filter function to 'wa_fronted_options' that passes and returns a multidimensional array. Note that both themes and plugins can call this filter before or after eachother and build upon or replace options.
The first level of the array consists of the key "defaults" (optional) and "post_types". In "defaults", specify whatever you want to be set as default when you have not set anything else in that specific area. In "post_types" you create an array for each post type you want to enable frontend editing for (you can also use 'front_page' if you just want to target your static front page). Inside, you set "editable_areas" with an array with options for each editable area on this post type.
@@ -57,12 +58,13 @@ add_filter('wa_fronted_options', 'my_editor_options');
## Options
* **container** (required, string): selector of wrapping element of what you want to edit. Can be any valid jQuery selector string
-* **field_type** (required, string): `post_content`, `post_title`, `acf_{FIELD ID}` / `acf_sub_{SUBFIELD ID}` (if set and **toolbar** is not specified, **toolbar** will set itself based on what field it is)
+* **field_type** (required, string): `post_content`, `post_title`, `post_thumbnail` (note that if you don't use the_post_thumbnail() function, the image has to have the class 'attachment-post-thumbnail'), `acf_{FIELD ID}` / `acf_sub_{SUBFIELD ID}` (if set and **toolbar** is not specified, **toolbar** will set itself based on what field it is)
* **permission** (optional, string): `logged-in` (enable to all logged in users), `default` (default, enabled if user has capability *edit_posts*), `{USER ROLE}` (enable to specific user role)
* **post_id** (optional, int): Insert post id to override the `global $post` variable. If used in combination with `acf_{FIELD ID}`, note that it can also be set to *options / taxonomies / users / etc*
* **toolbar** (optional, mixed bool/string): `full` (default, all buttons), `false` (do not show toolbar), `comma-separated string` (bold, italic, underline, anchor, header1, header2, quote, unorderedlist, orderedlist, justifyLeft, justifyCenter, justifyRight)
* **media_upload** (optional, mixed bool/string): `true` (default, will allow user to insert/upload media to the editable area), `false` (disable media upload), `only` (constrain the editable area to only edit media. ie; no text, no toolbar)
-* **output** (optional, string): *only applies to ACF fields with complex output* value to retrieve from get_field() to output as a dot separated string representing the traversing of value array, ie. for an image field that should output the thumbnail: "sizes.thumbnail".
+* **image_size** (optional, string): any registered image size *(only applicable if **field_type** is set and you want another image size than WP default, which is 'post-thumbnail')*
+* **output** (optional, string): alue to retrieve from get_field() to output as a dot separated string representing the traversing of value array, ie. for an image field that should output the thumbnail: "sizes.thumbnail" *(only applicable to ACF fields with complex output)*
* **output_to** (optional, array): *if not specified, the returned data after save will be put directly into the container element*
```php
array(
@@ -77,6 +79,7 @@ array(
* **wa_after_fronted_scripts** runs after plugin has registered all its scripts and styles (passes complete options array as argument)
* **wa_fronted_save** runs after regular save function (passes $data as argument)
* **wa_fronted_autosave** runs after regular autosave function (passes $data as argument)
+* **wa_fronted_toolbar** runs when bottom toolbar renders (before ending ) (passes complete options array as argument)
*I'll try to add hooks where I see it could be useful, but if you are missing one, please post an issue requesting it*
@@ -99,15 +102,21 @@ array(
* Image
* File
-##Pending features
-> These are features that are planned to be implemented in the near future (in no particular order)
+##Features
+> Unchecked boxes are features that are planned to be implemented in the near future (in no particular order)
-* [ ] Ability to edit featured image
-* [ ] Show unsaved changes warning if leaving page
-* [ ] Ability to edit other columns from the posts table (like post_author, post_date and so on)
+* [x] Automatic changing of image size to load when changing size of image in content
+* [x] Gallery shortcode editing
+* [x] Advanced Custom Fields support (see supported ACF fields for more details)
+* [x] Automatic oEmbed conversion upon paste
+* [x] Automatic url to link conversion
+* [x] Automatic updates
+* [x] Ability to edit featured image
+* [x] Show unsaved changes warning if leaving page
+* [ ] Ability to edit other columns from the posts table (like post_author, post_date, post_status and so on)
* [ ] Native custom fields support
* [ ] Shortcodes support (other than gallery)
-* [ ] Autosave
+* [ ] Autosave (need some discussion on how to best implement this)
* [ ] WooCommerce support (other than standard WP-fields)
* [ ] Image upload by dropping an image into the editable area
* [ ] Drag image to move it within the editable area
@@ -116,21 +125,23 @@ array(
* [ ] Choice-based fields like dropdown-select (click on content to show dropdown and select option to insert)
* [ ] More ACF fields support
* [ ] Smarter outputting of value (like if it's an image field and has no output options, determine by itself)
-* [ ] Enable editing from archives/blog home
* [ ] Post revisions
* [ ] Edit taxonomies (and native tags and categories)
-* [ ] Make it possible to create new posts from frontend
* [ ] How-to guide for integration and extensions
-* [x] oEmbed support in wysiwyg
-* [x] Updates
-* [x] Automatic updates
+* [ ] Translation
+* [ ] Mirror style of current WP admin theme
##Proposed features
> These features requires further discussion, not yet set to be implemented
-* [ ] Spellchecking and wordsuggestion, autocorrection
+* [ ] Enhance UX by visualizing which area you are editing
+* [ ] Make it possible to create new posts from frontend
+* [ ] Change common ajax functions to make use of WP Rest API instead (when implemented into core)
+* [ ] Spellchecking and word suggestion, auto correction
* [ ] Ability to update widget contents
-* [ ] Column-maker
+* [ ] Editing from archives/blog home
+* [ ] Markdown parser
+* [ ] Column-maker (made as an add-on?)
##Collaboration notes
* I'm using sass for styling and [PrePros](https://prepros.io/) for compiling (there's a free version if you wanna check it out)
diff --git a/css/style.css b/css/style.css
index fedf9e0..5d52b38 100644
--- a/css/style.css
+++ b/css/style.css
@@ -6484,7 +6484,7 @@ body .ui-tooltip {
border-radius: 8px;
}
-.medium-editor-toolbar ul li button, .medium-wa-image-upload-action, .edit-acf-field, #wa-fronted-save-toolbar #wa-fronted-save, #acf-dialog #close-acf-dialog {
+.medium-editor-toolbar ul li button, .medium-wa-image-upload-action, .edit-acf-field, #wa-fronted-toolbar > button, #acf-dialog #close-acf-dialog {
box-shadow: none !important;
text-shadow: none !important;
border-radius: 0;
@@ -6499,14 +6499,14 @@ body .ui-tooltip {
.medium-editor-toolbar ul li button.medium-editor-button-active,
.medium-editor-button-active.medium-wa-image-upload-action,
.medium-editor-button-active.edit-acf-field,
-#wa-fronted-save-toolbar .medium-editor-button-active#wa-fronted-save,
+#wa-fronted-toolbar > button.medium-editor-button-active,
#acf-dialog .medium-editor-button-active#close-acf-dialog,
.medium-editor-toolbar ul li button.active,
.active.medium-wa-image-upload-action,
.active.edit-acf-field,
-#wa-fronted-save-toolbar .active#wa-fronted-save,
+#wa-fronted-toolbar > button.active,
#acf-dialog .active#close-acf-dialog,
-.medium-editor-toolbar ul li button:hover, .medium-wa-image-upload-action:hover, .edit-acf-field:hover, #wa-fronted-save-toolbar #wa-fronted-save:hover, #acf-dialog #close-acf-dialog:hover {
+.medium-editor-toolbar ul li button:hover, .medium-wa-image-upload-action:hover, .edit-acf-field:hover, #wa-fronted-toolbar > button:hover, #acf-dialog #close-acf-dialog:hover {
background: #333;
color: #45bbe6;
}
@@ -6669,28 +6669,38 @@ body .ui-tooltip {
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.2);
}
+.wa-fronted-editor img.wp-post-image,
.wa-fronted-editor img[class*="wp-image"] {
cursor: pointer;
}
-#wa-fronted-save-toolbar {
+#wa-fronted-toolbar {
position: fixed;
bottom: 0;
left: 0;
display: block;
- background-color: #222;
width: 100%;
text-align: center;
- display: none;
+ font: 400 13px/32px "Open Sans", sans-serif;
}
-#wa-fronted-save-toolbar #wa-fronted-save {
+#wa-fronted-toolbar > button {
+ background-color: #222;
padding: 5px 10px;
text-transform: uppercase;
font-size: 14px;
line-height: 2;
}
+#wa-fronted-toolbar > button i {
+ vertical-align: middle;
+ margin-top: -5px;
+}
+
+#wa-fronted-toolbar #wa-fronted-save {
+ display: none;
+}
+
#wa-fronted-spinner {
position: fixed;
top: 0;
diff --git a/images/picture-edit.cur b/images/picture-edit.cur
new file mode 100644
index 0000000..f2336a8
Binary files /dev/null and b/images/picture-edit.cur differ
diff --git a/images/picture-edit.svg b/images/picture-edit.svg
new file mode 100644
index 0000000..2654244
--- /dev/null
+++ b/images/picture-edit.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/js/medium-wa-image-upload.js b/js/medium-wa-image-upload.js
index 2d6323f..a402f50 100644
--- a/js/medium-wa-image-upload.js
+++ b/js/medium-wa-image-upload.js
@@ -1,5 +1,6 @@
/**
- * MediumEditor extension to enable media uploads through wp.media (Media Gallery)
+ * MediumEditor extension to enable media uploads through wp.media (Media Gallery),
+ * editing inserting images in content as well as gallery shortcodes and featured image
*/
function Wa_image_upload(this_options) {
this.editor_options = this_options;
@@ -60,6 +61,14 @@ Wa_image_upload.prototype.setup_wp_media = function(type, shortcode_string, shor
multiple: true
});
}
+ }else if(type === 'featured-image'){
+ this.frame = wp.media({
+ frame: 'post',
+ state: 'featured-image',
+ states: [ new wp.media.controller.FeaturedImage() , new wp.media.controller.EditImage() ],
+ // editing: true,
+ // multiple: false
+ });
}
this.frame.on( 'insert', function() {
@@ -79,6 +88,15 @@ Wa_image_upload.prototype.setup_wp_media = function(type, shortcode_string, shor
this.frame.on( 'update', function() {
self.insertGallery(self.frame, shortcode_wrap);
});
+
+ this.frame.state('featured-image').on( 'select', function() {
+ var selection = self.frame.state().get('selection').single();
+ if(typeof self.replace_this !== 'undefined' && self.replace_this !== false){
+ self.insertImage(self.frame, self.replace_this);
+ }else{
+ self.insertImage(self.frame);
+ }
+ });
}
/**
@@ -164,6 +182,7 @@ Wa_image_upload.prototype.get_closest_image_size = function(attachment_id, heigh
}
}
+ clearTimeout(this.get_image_src_timeout);
this.get_image_src_timeout = setTimeout(function(){
if(closest.size_name !== null){
jQuery.post(
@@ -241,11 +260,28 @@ Wa_image_upload.prototype.bindings = function(instance, editor_container){
self.replace_this = img_wrap;
- self.setup_wp_media('insert');
+
var class_match = e.target.className.match(/wp-image-\d+/);
-
if(class_match !== null){
+ self.setup_wp_media('insert');
self.WPMedia(parseInt(class_match[0].match(/\d+/)[0]));
+ }else{
+ self.setup_wp_media('featured-image');
+ wa_fronted.show_loading_spinner();
+ jQuery.post(
+ global_vars.ajax_url,
+ {
+ 'action' : 'wa_get_thumbnail_id',
+ 'post_id' : self.editor_options.post_id
+ },
+ function(response){
+ if(response.attachment_id !== '' && response.attachment_id !== false){
+ wp.media.view.settings.post.featuredImageId = parseInt(response.attachment_id);
+ self.WPMedia(parseInt(response.attachment_id));
+ }
+ wa_fronted.hide_loading_spinner();
+ }
+ );
}
}
@@ -403,7 +439,9 @@ Wa_image_upload.prototype.insertImage = function(frame, replace_this){
selection.each(function(attachment) {
var display = state.display( attachment ).toJSON(),
obj_attachment = attachment.toJSON(),
- caption = obj_attachment.caption, options, html;
+ caption = obj_attachment.caption,
+ options,
+ html;
// If captions are disabled, clear the caption.
if ( ! wp.media.view.settings.captions )
@@ -412,58 +450,84 @@ Wa_image_upload.prototype.insertImage = function(frame, replace_this){
display = wp.media.string.props( display, obj_attachment );
options = {
- id: obj_attachment.id,
- post_content: obj_attachment.description,
- post_excerpt: caption
+ id : obj_attachment.id,
+ post_content : obj_attachment.description,
+ post_excerpt : caption
};
+ if(state.id !== 'featured-image') {
- if ( display.linkUrl )
- options.url = display.linkUrl;
+ if ( display.linkUrl )
+ options.url = display.linkUrl;
- if ( 'image' === obj_attachment.type ) {
- display.url = display.src;
+ if ( 'image' === obj_attachment.type ) {
+ display.url = display.src;
- html = wp.media.string.image( display );
-
- _.each({
- align: 'align',
- size: 'image-size',
- alt: 'image_alt'
- }, function( option, prop ) {
- if ( display[ prop ] )
- options[ option ] = display[ prop ];
- });
- } else if ( 'video' === obj_attachment.type ) {
- html = wp.media.string.video( display, obj_attachment );
- } else if ( 'audio' === obj_attachment.type ) {
- html = wp.media.string.audio( display, obj_attachment );
- } else {
- html = wp.media.string.link( display );
- options.post_title = display.title;
- }
+ html = wp.media.string.image( display );
- //attach info to attachment.attributes object
- attachment.attributes['nonce'] = wp.media.view.settings.nonce.sendToEditor;
- attachment.attributes['attachment'] = options;
- attachment.attributes['html'] = html;
- attachment.attributes['post_id'] = wp.media.view.settings.post.id;
-
- if(replace_this !== false){
- if( wp.media.view.settings.captions && caption ){
- wa_fronted.shortcode_to_html(attachment.attributes['html'], true, function(html){
- wa_fronted.replace_html(replace_this, html);
- self.replace_this = false;
+ _.each({
+ align: 'align',
+ size: 'image-size',
+ alt: 'image_alt'
+ }, function( option, prop ) {
+ if ( display[ prop ] )
+ options[ option ] = display[ prop ];
});
+ } else if ( 'video' === obj_attachment.type ) {
+ html = wp.media.string.video( display, obj_attachment );
+ } else if ( 'audio' === obj_attachment.type ) {
+ html = wp.media.string.audio( display, obj_attachment );
+ } else {
+ html = wp.media.string.link( display );
+ options.post_title = display.title;
+ }
+
+ //attach info to attachment.attributes object
+ attachment.attributes['nonce'] = wp.media.view.settings.nonce.sendToEditor;
+ attachment.attributes['attachment'] = options;
+ attachment.attributes['html'] = html;
+ attachment.attributes['post_id'] = wp.media.view.settings.post.id;
+
+ if(replace_this !== false){
+ if( wp.media.view.settings.captions && caption ){
+ wa_fronted.shortcode_to_html(attachment.attributes['html'], true, function(html){
+ wa_fronted.replace_html(replace_this, html);
+ self.replace_this = false;
+ });
+ }else{
+ wa_fronted.replace_html(replace_this, attachment.attributes['html']);
+ self.replace_this = false;
+ }
}else{
- wa_fronted.replace_html(replace_this, attachment.attributes['html']);
- self.replace_this = false;
+ wa_fronted.insertHtmlAtCaret(attachment.attributes['html']);
}
- }else{
- wa_fronted.insertHtmlAtCaret(attachment.attributes['html']);
+
+ wa_fronted.trigger(self.instance, 'editableInput');
+ self.enable_resizing(self.instance, jQuery(self.instance.elements));
+
+ } else {
+
+ wa_fronted.show_loading_spinner();
+ jQuery.post(
+ global_vars.ajax_url,
+ {
+ 'action' : 'wa_set_thumbnail',
+ 'attachment_id' : options.id,
+ 'image_size' : self.editor_options.image_size,
+ 'post_id' : self.editor_options.post_id
+ },
+ function(response){
+ if(response.hasOwnProperty('html')){
+ if(replace_this !== false){
+ wa_fronted.replace_html(replace_this, response.html);
+ self.replace_this = false;
+ }
+ }
+ wa_fronted.hide_loading_spinner();
+ }
+ );
+
}
- wa_fronted.trigger(self.instance, 'editableInput');
- self.enable_resizing(self.instance, jQuery(self.instance.elements));
});
};
diff --git a/js/min/scripts.min.js b/js/min/scripts.min.js
index 4d29908..232d873 100644
--- a/js/min/scripts.min.js
+++ b/js/min/scripts.min.js
@@ -1,8 +1,8 @@
-window.Modernizr=function(e,t,n){function a(e){v.cssText=e}function i(e,t){return a(b.join(e+";")+(t||""))}function o(e,t){return typeof e===t}function r(e,t){return!!~(""+e).indexOf(t)}function s(e,t){for(var a in e){var i=e[a];if(!r(i,"-")&&v[i]!==n)return"pfx"==t?i:!0}return!1}function l(e,t,a){for(var i in e){var r=t[e[i]];if(r!==n)return a===!1?e[i]:o(r,"function")?r.bind(a||t):r}return!1}function c(e,t,n){var a=e.charAt(0).toUpperCase()+e.slice(1),i=(e+" "+j.join(a+" ")+a).split(" ");return o(t,"string")||o(t,"undefined")?s(i,t):(i=(e+" "+C.join(a+" ")+a).split(" "),l(i,t,n))}var u,d,f,p="2.8.3",m={},h=!0,g=t.documentElement,_="modernizr",y=t.createElement(_),v=y.style,b=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),w="Webkit Moz O ms",j=w.split(" "),C=w.toLowerCase().split(" "),x={},E=[],S=E.slice,z=function(e,n,a,i){var o,r,s,l,c=t.createElement("div"),u=t.body,d=u||t.createElement("body");if(parseInt(a,10))for(;a--;)s=t.createElement("div"),s.id=i?i[a]:_+(a+1),c.appendChild(s);return o=["",'"].join(""),c.id=_,(u?c:d).innerHTML+=o,d.appendChild(c),u||(d.style.background="",d.style.overflow="hidden",l=g.style.overflow,g.style.overflow="hidden",g.appendChild(d)),r=n(c,e),u?c.parentNode.removeChild(c):(d.parentNode.removeChild(d),g.style.overflow=l),!!r},k={}.hasOwnProperty;f=o(k,"undefined")||o(k.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return k.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=S.call(arguments,1),a=function(){if(this instanceof a){var i=function(){};i.prototype=t.prototype;var o=new i,r=t.apply(o,n.concat(S.call(arguments)));return Object(r)===r?r:o}return t.apply(e,n.concat(S.call(arguments)))};return a}),x.opacity=function(){return i("opacity:.55"),/^0.55$/.test(v.opacity)},x.cssanimations=function(){return c("animationName")},x.csstransforms=function(){return!!c("transform")},x.csstransforms3d=function(){var e=!!c("perspective");return e&&"webkitPerspective"in g.style&&z("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t,n){e=9===t.offsetLeft&&3===t.offsetHeight}),e},x.csstransitions=function(){return c("transition")};for(var Q in x)f(x,Q)&&(d=Q.toLowerCase(),m[d]=x[Q](),E.push((m[d]?"":"no-")+d));return m.addTest=function(e,t){if("object"==typeof e)for(var a in e)f(e,a)&&m.addTest(a,e[a]);else{if(e=e.toLowerCase(),m[e]!==n)return m;t="function"==typeof t?t():t,"undefined"!=typeof h&&h&&(g.className+=" "+(t?"":"no-")+e),m[e]=t}return m},a(""),y=u=null,function(e,t){function n(e,t){var n=e.createElement("p"),a=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x",a.insertBefore(n.lastChild,a.firstChild)}function a(){var e=y.elements;return"string"==typeof e?e.split(" "):e}function i(e){var t=_[e[h]];return t||(t={},g++,e[h]=g,_[g]=t),t}function o(e,n,a){if(n||(n=t),u)return n.createElement(e);a||(a=i(n));var o;return o=a.cache[e]?a.cache[e].cloneNode():m.test(e)?(a.cache[e]=a.createElem(e)).cloneNode():a.createElem(e),!o.canHaveChildren||p.test(e)||o.tagUrn?o:a.frag.appendChild(o)}function r(e,n){if(e||(e=t),u)return e.createDocumentFragment();n=n||i(e);for(var o=n.frag.cloneNode(),r=0,s=a(),l=s.length;l>r;r++)o.createElement(s[r]);return o}function s(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return y.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+a().join().replace(/[\w\-]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(y,t.frag)}function l(e){e||(e=t);var a=i(e);return y.shivCSS&&!c&&!a.hasCSS&&(a.hasCSS=!!n(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),u||s(e,a),e}var c,u,d="3.7.0",f=e.html5||{},p=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,m=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,h="_html5shiv",g=0,_={};!function(){try{var e=t.createElement("a");e.innerHTML="",c="hidden"in e,u=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){c=!0,u=!0}}();var y={elements:f.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:d,shivCSS:f.shivCSS!==!1,supportsUnknownElements:u,shivMethods:f.shivMethods!==!1,type:"default",shivDocument:l,createElement:o,createDocumentFragment:r};e.html5=y,l(t)}(this,t),m._version=p,m._prefixes=b,m._domPrefixes=C,m._cssomPrefixes=j,m.testProp=function(e){return s([e])},m.testAllProps=c,m.testStyles=z,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(h?" js "+E.join(" "):""),m}(this,this.document),function(e,t,n){function a(e){return"[object Function]"==g.call(e)}function i(e){return"string"==typeof e}function o(){}function r(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function s(){var e=_.shift();y=1,e?e.t?m(function(){("c"==e.t?f.injectCss:f.injectJs)(e.s,0,e.a,e.x,e.e,1)},0):(e(),s()):y=0}function l(e,n,a,i,o,l,c){function u(t){if(!p&&r(d.readyState)&&(v.r=p=1,!y&&s(),d.onload=d.onreadystatechange=null,t)){"img"!=e&&m(function(){w.removeChild(d)},50);for(var a in S[n])S[n].hasOwnProperty(a)&&S[n][a].onload()}}var c=c||f.errorTimeout,d=t.createElement(e),p=0,g=0,v={t:a,s:n,e:o,a:l,x:c};1===S[n]&&(g=1,S[n]=[]),"object"==e?d.data=n:(d.src=n,d.type=e),d.width=d.height="0",d.onerror=d.onload=d.onreadystatechange=function(){u.call(this,g)},_.splice(i,0,v),"img"!=e&&(g||2===S[n]?(w.insertBefore(d,b?null:h),m(u,c)):S[n].push(d))}function c(e,t,n,a,o){return y=0,t=t||"j",i(e)?l("c"==t?C:j,e,t,this.i++,n,a,o):(_.splice(this.i++,0,e),1==_.length&&s()),this}function u(){var e=f;return e.loader={load:c,i:0},e}var d,f,p=t.documentElement,m=e.setTimeout,h=t.getElementsByTagName("script")[0],g={}.toString,_=[],y=0,v="MozAppearance"in p.style,b=v&&!!t.createRange().compareNode,w=b?p:h.parentNode,p=e.opera&&"[object Opera]"==g.call(e.opera),p=!!t.attachEvent&&!p,j=v?"object":p?"script":"img",C=p?"script":j,x=Array.isArray||function(e){return"[object Array]"==g.call(e)},E=[],S={},z={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};f=function(e){function t(e){var t,n,a,e=e.split("!"),i=E.length,o=e.pop(),r=e.length,o={url:o,origUrl:o,prefixes:e};for(n=0;r>n;n++)a=e[n].split("="),(t=z[a.shift()])&&(o=t(o,a));for(n=0;i>n;n++)o=E[n](o);return o}function r(e,i,o,r,s){var l=t(e),c=l.autoCallback;l.url.split(".").pop().split("?").shift(),l.bypass||(i&&(i=a(i)?i:i[e]||i[r]||i[e.split("/").pop().split("?")[0]]),l.instead?l.instead(e,i,o,r,s):(S[l.url]?l.noexec=!0:S[l.url]=1,o.load(l.url,l.forceCSS||!l.forceJS&&"css"==l.url.split(".").pop().split("?").shift()?"c":n,l.noexec,l.attrs,l.timeout),(a(i)||a(c))&&o.load(function(){u(),i&&i(l.origUrl,s,r),c&&c(l.origUrl,s,r),S[l.url]=2})))}function s(e,t){function n(e,n){if(e){if(i(e))n||(d=function(){var e=[].slice.call(arguments);f.apply(this,e),p()}),r(e,d,t,0,c);else if(Object(e)===e)for(l in s=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(l)&&(!n&&!--s&&(a(d)?d=function(){var e=[].slice.call(arguments);f.apply(this,e),p()}:d[l]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),p()}}(f[l])),r(e[l],d,t,l,c))}else!n&&p()}var s,l,c=!!e.test,u=e.load||e.both,d=e.callback||o,f=d,p=e.complete||o;n(c?e.yep:e.nope,!!u),u&&n(u)}var l,c,d=this.yepnope.loader;if(i(e))r(e,0,d,0);else if(x(e))for(l=0;l',e,""].join(""),c.id=_,(u?c:d).innerHTML+=o,d.appendChild(c),u||(d.style.background="",d.style.overflow="hidden",l=g.style.overflow,g.style.overflow="hidden",g.appendChild(d)),r=n(c,e),u?c.parentNode.removeChild(c):(d.parentNode.removeChild(d),g.style.overflow=l),!!r},k={}.hasOwnProperty;f=o(k,"undefined")||o(k.call,"undefined")?function(e,t){return t in e&&o(e.constructor.prototype[t],"undefined")}:function(e,t){return k.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=S.call(arguments,1),a=function(){if(this instanceof a){var i=function(){};i.prototype=t.prototype;var o=new i,r=t.apply(o,n.concat(S.call(arguments)));return Object(r)===r?r:o}return t.apply(e,n.concat(S.call(arguments)))};return a}),E.opacity=function(){return i("opacity:.55"),/^0.55$/.test(v.opacity)},E.cssanimations=function(){return c("animationName")},E.csstransforms=function(){return!!c("transform")},E.csstransforms3d=function(){var e=!!c("perspective");return e&&"webkitPerspective"in g.style&&z("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t,n){e=9===t.offsetLeft&&3===t.offsetHeight}),e},E.csstransitions=function(){return c("transition")};for(var N in E)f(E,N)&&(d=N.toLowerCase(),m[d]=E[N](),x.push((m[d]?"":"no-")+d));return m.addTest=function(e,t){if("object"==typeof e)for(var a in e)f(e,a)&&m.addTest(a,e[a]);else{if(e=e.toLowerCase(),m[e]!==n)return m;t="function"==typeof t?t():t,"undefined"!=typeof h&&h&&(g.className+=" "+(t?"":"no-")+e),m[e]=t}return m},a(""),y=u=null,function(e,t){function n(e,t){var n=e.createElement("p"),a=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x",a.insertBefore(n.lastChild,a.firstChild)}function a(){var e=y.elements;return"string"==typeof e?e.split(" "):e}function i(e){var t=_[e[h]];return t||(t={},g++,e[h]=g,_[g]=t),t}function o(e,n,a){if(n||(n=t),u)return n.createElement(e);a||(a=i(n));var o;return o=a.cache[e]?a.cache[e].cloneNode():m.test(e)?(a.cache[e]=a.createElem(e)).cloneNode():a.createElem(e),!o.canHaveChildren||p.test(e)||o.tagUrn?o:a.frag.appendChild(o)}function r(e,n){if(e||(e=t),u)return e.createDocumentFragment();n=n||i(e);for(var o=n.frag.cloneNode(),r=0,s=a(),l=s.length;l>r;r++)o.createElement(s[r]);return o}function s(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return y.shivMethods?o(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+a().join().replace(/[\w\-]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(y,t.frag)}function l(e){e||(e=t);var a=i(e);return y.shivCSS&&!c&&!a.hasCSS&&(a.hasCSS=!!n(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),u||s(e,a),e}var c,u,d="3.7.0",f=e.html5||{},p=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,m=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,h="_html5shiv",g=0,_={};!function(){try{var e=t.createElement("a");e.innerHTML="",c="hidden"in e,u=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){c=!0,u=!0}}();var y={elements:f.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:d,shivCSS:f.shivCSS!==!1,supportsUnknownElements:u,shivMethods:f.shivMethods!==!1,type:"default",shivDocument:l,createElement:o,createDocumentFragment:r};e.html5=y,l(t)}(this,t),m._version=p,m._prefixes=b,m._domPrefixes=C,m._cssomPrefixes=j,m.testProp=function(e){return s([e])},m.testAllProps=c,m.testStyles=z,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(h?" js "+x.join(" "):""),m}(this,this.document),function(e,t,n){function a(e){return"[object Function]"==g.call(e)}function i(e){return"string"==typeof e}function o(){}function r(e){return!e||"loaded"==e||"complete"==e||"uninitialized"==e}function s(){var e=_.shift();y=1,e?e.t?m(function(){("c"==e.t?f.injectCss:f.injectJs)(e.s,0,e.a,e.x,e.e,1)},0):(e(),s()):y=0}function l(e,n,a,i,o,l,c){function u(t){if(!p&&r(d.readyState)&&(v.r=p=1,!y&&s(),d.onload=d.onreadystatechange=null,t)){"img"!=e&&m(function(){w.removeChild(d)},50);for(var a in S[n])S[n].hasOwnProperty(a)&&S[n][a].onload()}}var c=c||f.errorTimeout,d=t.createElement(e),p=0,g=0,v={t:a,s:n,e:o,a:l,x:c};1===S[n]&&(g=1,S[n]=[]),"object"==e?d.data=n:(d.src=n,d.type=e),d.width=d.height="0",d.onerror=d.onload=d.onreadystatechange=function(){u.call(this,g)},_.splice(i,0,v),"img"!=e&&(g||2===S[n]?(w.insertBefore(d,b?null:h),m(u,c)):S[n].push(d))}function c(e,t,n,a,o){return y=0,t=t||"j",i(e)?l("c"==t?C:j,e,t,this.i++,n,a,o):(_.splice(this.i++,0,e),1==_.length&&s()),this}function u(){var e=f;return e.loader={load:c,i:0},e}var d,f,p=t.documentElement,m=e.setTimeout,h=t.getElementsByTagName("script")[0],g={}.toString,_=[],y=0,v="MozAppearance"in p.style,b=v&&!!t.createRange().compareNode,w=b?p:h.parentNode,p=e.opera&&"[object Opera]"==g.call(e.opera),p=!!t.attachEvent&&!p,j=v?"object":p?"script":"img",C=p?"script":j,E=Array.isArray||function(e){return"[object Array]"==g.call(e)},x=[],S={},z={timeout:function(e,t){return t.length&&(e.timeout=t[0]),e}};f=function(e){function t(e){var t,n,a,e=e.split("!"),i=x.length,o=e.pop(),r=e.length,o={url:o,origUrl:o,prefixes:e};for(n=0;r>n;n++)a=e[n].split("="),(t=z[a.shift()])&&(o=t(o,a));for(n=0;i>n;n++)o=x[n](o);return o}function r(e,i,o,r,s){var l=t(e),c=l.autoCallback;l.url.split(".").pop().split("?").shift(),l.bypass||(i&&(i=a(i)?i:i[e]||i[r]||i[e.split("/").pop().split("?")[0]]),l.instead?l.instead(e,i,o,r,s):(S[l.url]?l.noexec=!0:S[l.url]=1,o.load(l.url,l.forceCSS||!l.forceJS&&"css"==l.url.split(".").pop().split("?").shift()?"c":n,l.noexec,l.attrs,l.timeout),(a(i)||a(c))&&o.load(function(){u(),i&&i(l.origUrl,s,r),c&&c(l.origUrl,s,r),S[l.url]=2})))}function s(e,t){function n(e,n){if(e){if(i(e))n||(d=function(){var e=[].slice.call(arguments);f.apply(this,e),p()}),r(e,d,t,0,c);else if(Object(e)===e)for(l in s=function(){var t,n=0;for(t in e)e.hasOwnProperty(t)&&n++;return n}(),e)e.hasOwnProperty(l)&&(!n&&!--s&&(a(d)?d=function(){var e=[].slice.call(arguments);f.apply(this,e),p()}:d[l]=function(e){return function(){var t=[].slice.call(arguments);e&&e.apply(this,t),p()}}(f[l])),r(e[l],d,t,l,c))}else!n&&p()}var s,l,c=!!e.test,u=e.load||e.both,d=e.callback||o,f=d,p=e.complete||o;n(c?e.yep:e.nope,!!u),u&&n(u)}var l,c,d=this.yepnope.loader;if(i(e))r(e,0,d,0);else if(E(e))for(l=0;lb;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++ci;i++)e+=String.fromCharCode(f[i]);c.push(e)}else if("Blob"===b(a)||"File"===b(a)){if(!g)throw new h("NOT_READABLE_ERR");var k=new g;c.push(k.readAsBinaryString(a))}else a instanceof d?"base64"===a.encoding&&p?c.push(p(a.data)):"URI"===a.encoding?c.push(decodeURIComponent(a.data)):"raw"===a.encoding&&c.push(a.data):("string"!=typeof a&&(a+=""),c.push(unescape(encodeURIComponent(a))))},e.getBlob=function(a){return arguments.length||(a=null),new d(this.data.join(""),a,"raw")},e.toString=function(){return"[object BlobBuilder]"},f.slice=function(a,b,c){var e=arguments.length;return 3>e&&(c=null),new d(this.data.slice(a,e>1?b:this.data.length),c,this.encoding)},f.toString=function(){return"[object Blob]"},f.close=function(){this.size=0,delete this.data},c}(a);a.Blob=function(a,b){var d=b?b.type||"":"",e=new c;if(a)for(var f=0,g=a.length;g>f;f++)e.append(Uint8Array&&a[f]instanceof Uint8Array?a[f].buffer:a[f]);var h=e.getBlob(d);return!h.slice&&h.webkitSlice&&(h.slice=h.webkitSlice),h};var d=Object.getPrototypeOf||function(a){return a.__proto__};a.Blob.prototype=d(new a.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this),function(a,b){"use strict";"object"==typeof module?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):a.MediumEditor=b}(this,function(){"use strict";function a(a,b){return this.init(a,b)}var b;!function(a){function c(a,b){var c,d=Array.prototype.slice.call(arguments,2);b=b||{};for(var e=0;e=0,keyCode:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,K:75},isMetaCtrlKey:function(a){return this.isMac&&a.metaKey||!this.isMac&&a.ctrlKey?!0:!1},isKey:function(a,b){var c=this.getKeyCode(a);return!1===Array.isArray(b)?c===b:-1===b.indexOf(c)?!1:!0},getKeyCode:function(a){var b=a.which;return null===b&&(b=null!==a.charCode?a.charCode:a.keyCode),b},blockContainerElementNames:["p","h1","h2","h3","h4","h5","h6","blockquote","pre"],emptyElementNames:["br","col","colgroup","hr","img","input","source","wbr"],extend:function(){var a=[!0].concat(Array.prototype.slice.call(arguments));return c.apply(this,a)},defaults:function(){var a=[!1].concat(Array.prototype.slice.call(arguments));return c.apply(this,a)},createLink:function(a,c,d,e){var f=a.createElement("a");return b.moveTextRangeIntoElement(c[0],c[c.length-1],f),f.setAttribute("href",d),e&&f.setAttribute("target",e),f},findOrCreateMatchingTextNodes:function(a,c,d){for(var e=a.createTreeWalker(c,NodeFilter.SHOW_TEXT,null,!1),f=[],g=0,h=!1,i=null,j=null;null!==(i=e.nextNode())&&(!h&&d.startd.end+1)throw new Error("PerformLinking overshot the target!");h&&f.push(j||i),g+=i.nodeValue.length,null!==j&&(g+=j.nodeValue.length,e.nextNode()),j=null}return f},splitStartNodeIfNeeded:function(a,b,c){return b!==c?a.splitText(b-c):null},splitEndNodeIfNeeded:function(a,b,c,d){var e,f;e=d+(b||a).nodeValue.length+(b?a.nodeValue.length:0)-1,f=(b||a).nodeValue.length-(e+1-c),e>=c&&d!==e&&0!==f&&(b||a).splitText(f)},findAdjacentTextNodeWithContent:function(a,b,c){var d,e=!1,f=c.createNodeIterator(a,NodeFilter.SHOW_TEXT,null,!1);for(d=f.nextNode();d;){if(d===b)e=!0;else if(e&&3===d.nodeType&&d.nodeValue&&d.nodeValue.trim().length>0)break;d=f.nextNode()}return d},isDescendant:function(a,b,c){if(!a||!b)return!1;if(c&&a===b)return!0;for(var d=b.parentNode;null!==d;){if(d===a)return!0;d=d.parentNode}return!1},isElement:function(a){return!(!a||1!==a.nodeType)},throttle:function(a,b){var c,d,e,f=50,g=null,h=0,i=function(){h=Date.now(),g=null,e=a.apply(c,d),g||(c=d=null)};return b||0===b||(b=f),function(){var f=Date.now(),j=b-(f-h);return c=this,d=arguments,0>=j||j>b?(g&&(clearTimeout(g),g=null),h=f,e=a.apply(c,d),g||(c=d=null)):g||(g=setTimeout(i,j)),e}},traverseUp:function(a,c){if(!a)return!1;do{if(1===a.nodeType){if(c(a))return a;if(b.isMediumEditorElement(a))return!1}a=a.parentNode}while(a);return!1},htmlEntities:function(a){return String(a).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")},insertHTMLCommand:function(a,c){var d,e,f,g,h,i,j;if(a.queryCommandSupported("insertHTML"))try{return a.execCommand("insertHTML",!1,c)}catch(k){}if(d=a.defaultView.getSelection(),d.getRangeAt&&d.rangeCount){if(e=d.getRangeAt(0),j=e.commonAncestorContainer,3===j.nodeType&&j.nodeValue===e.toString()||3!==j.nodeType&&j.innerHTML===e.toString()){for(;j.parentNode&&1===j.parentNode.childNodes.length&&!b.isMediumEditorElement(j.parentNode);)j=j.parentNode;e.selectNode(j)}for(e.deleteContents(),f=a.createElement("div"),f.innerHTML=c,g=a.createDocumentFragment();f.firstChild;)h=f.firstChild,i=g.appendChild(h);e.insertNode(g),i&&(e=e.cloneRange(),e.setStartAfter(i),e.collapse(!0),d.removeAllRanges(),d.addRange(e))}},execFormatBlock:function(a,c){var d=b.getTopBlockContainer(f.getSelectionStart(a));if("blockquote"===c){if(d){var e=Array.prototype.slice.call(d.childNodes);if(e.some(function(a){return b.isBlockContainer(a)}))return a.execCommand("outdent",!1,null)}if(this.isIE)return a.execCommand("indent",!1,c)}return d&&c===d.nodeName.toLowerCase()&&(c="p"),this.isIE&&(c="<"+c+">"),a.execCommand("formatBlock",!1,c)},setTargetBlank:function(a,b){var c,d=b||!1;if("a"===a.nodeName.toLowerCase())a.target="_blank";else for(a=a.getElementsByTagName("a"),c=0;cd?(e=e.parentNode,c-=1):(f=f.parentNode,d-=1);for(;e!==f;)e=e.parentNode,f=f.parentNode;return e},isElementAtBeginningOfBlock:function(a){for(var b,c;!this.isBlockContainer(a)&&!this.isMediumEditorElement(a);){for(c=a;c=c.previousSibling;)if(b=3===c.nodeType?c.nodeValue:c.textContent,b.length>0)return!1;a=a.parentNode}return!0},isMediumEditorElement:function(a){return a&&a.getAttribute&&!!a.getAttribute("data-medium-editor-element")},getContainerEditorElement:function(a){return b.traverseUp(a,function(a){return b.isMediumEditorElement(a)})},isBlockContainer:function(a){return a&&3!==a.nodeType&&-1!==this.blockContainerElementNames.indexOf(a.nodeName.toLowerCase())},getClosestBlockContainer:function(a){return b.traverseUp(a,function(a){return b.isBlockContainer(a)})},getTopBlockContainer:function(a){var c=a;return this.traverseUp(a,function(a){return b.isBlockContainer(a)&&(c=a),!1}),c},getFirstSelectableLeafNode:function(a){for(;a&&a.firstChild;)a=a.firstChild;if(a=this.traverseUp(a,function(a){return-1===b.emptyElementNames.indexOf(a.nodeName.toLowerCase())}),"table"===a.nodeName.toLowerCase()){var c=a.querySelector("th, td");c&&(a=c)}return a},getFirstTextNode:function(a){if(3===a.nodeType)return a;for(var b=0;bB",contentFA:''},italic:{name:"italic",action:"italic",aria:"italic",tagNames:["i","em"],style:{prop:"font-style",value:"italic"},useQueryState:!0,contentDefault:"I",contentFA:''},underline:{name:"underline",action:"underline",aria:"underline",tagNames:["u"],style:{prop:"text-decoration",value:"underline"},useQueryState:!0,contentDefault:"U",contentFA:''},strikethrough:{name:"strikethrough",action:"strikethrough",aria:"strike through",tagNames:["strike"],style:{prop:"text-decoration",value:"line-through"},useQueryState:!0,contentDefault:"A",contentFA:''},superscript:{name:"superscript",action:"superscript",aria:"superscript",tagNames:["sup"],contentDefault:"x1",contentFA:''},subscript:{name:"subscript",action:"subscript",aria:"subscript",tagNames:["sub"],contentDefault:"x1",contentFA:''},image:{name:"image",action:"image",aria:"image",tagNames:["img"],contentDefault:"image",contentFA:''},orderedlist:{name:"orderedlist",action:"insertorderedlist",aria:"ordered list",tagNames:["ol"],useQueryState:!0,contentDefault:"1.",contentFA:''},unorderedlist:{name:"unorderedlist",action:"insertunorderedlist",aria:"unordered list",tagNames:["ul"],useQueryState:!0,contentDefault:"•",contentFA:''},indent:{name:"indent",action:"indent",aria:"indent",tagNames:[],contentDefault:"→",contentFA:''},outdent:{name:"outdent",action:"outdent",aria:"outdent",tagNames:[],contentDefault:"←",contentFA:''},justifyCenter:{name:"justifyCenter",action:"justifyCenter",aria:"center justify",tagNames:[],style:{prop:"text-align",value:"center"},contentDefault:"C",contentFA:''},justifyFull:{name:"justifyFull",action:"justifyFull",aria:"full justify",tagNames:[],style:{prop:"text-align",value:"justify"},contentDefault:"J",contentFA:''},justifyLeft:{name:"justifyLeft",action:"justifyLeft",aria:"left justify",tagNames:[],style:{prop:"text-align",value:"left"},contentDefault:"L",contentFA:''},justifyRight:{name:"justifyRight",action:"justifyRight",aria:"right justify",tagNames:[],style:{prop:"text-align",value:"right"},contentDefault:"R",contentFA:''},removeFormat:{name:"removeFormat",aria:"remove formatting",action:"removeFormat",contentDefault:"X",contentFA:''},quote:{name:"quote",action:"append-blockquote",aria:"blockquote",tagNames:["blockquote"],contentDefault:"“",contentFA:''},pre:{name:"pre",action:"append-pre",aria:"preformatted text",tagNames:["pre"],contentDefault:"0101",contentFA:''},h1:{name:"h1",action:"append-h1",aria:"header type one",tagNames:["h1"],contentDefault:"H1",contentFA:'1'},h2:{name:"h2",action:"append-h2",aria:"header type two",tagNames:["h2"],contentDefault:"H2",contentFA:'2'},h3:{name:"h3",action:"append-h3",aria:"header type three",tagNames:["h3"],contentDefault:"H3",contentFA:'3'},h4:{name:"h4",action:"append-h4",aria:"header type four",tagNames:["h4"],contentDefault:"H4",contentFA:'4'},h5:{name:"h5",action:"append-h5",aria:"header type five",tagNames:["h5"],contentDefault:"H5",contentFA:'5'},h6:{name:"h6",action:"append-h6",aria:"header type six",tagNames:["h6"],contentDefault:"H6",contentFA:'6'}}}();var d;!function(){d={activeButtonClass:"medium-editor-button-active",buttonLabels:!1,delay:0,disableReturn:!1,disableDoubleReturn:!1,disableEditing:!1,autoLink:!1,elementsContainer:!1,contentWindow:window,ownerDocument:document,targetBlank:!1,extensions:{},spellcheck:!0}}();var e;!function(){e=function(a){b.extend(this,a)},e.extend=function(a){var c,d=this;c=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return d.apply(this,arguments)},b.extend(c,d);var e=function(){this.constructor=c};return e.prototype=d.prototype,c.prototype=new e,a&&b.extend(c.prototype,a),c},e.prototype={init:function(){},base:void 0,name:void 0,checkState:void 0,destroy:void 0,queryCommandState:void 0,isActive:void 0,isAlreadyApplied:void 0,setActive:void 0,setInactive:void 0,window:void 0,document:void 0,getEditorElements:function(){return this.base.elements},getEditorId:function(){return this.base.id},getEditorOption:function(a){return this.base.options[a]}},["execAction","on","off","subscribe","trigger"].forEach(function(a){e.prototype[a]=function(){return this.base[a].apply(this.base,arguments)}})}();var f;!function(){function a(a){return b.isBlockContainer(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}f={findMatchingSelectionParent:function(a,c){var d,e,f=c.getSelection();return 0===f.rangeCount?!1:(d=f.getRangeAt(0),e=d.commonAncestorContainer,b.traverseUp(e,a))},getSelectionElement:function(a){return this.findMatchingSelectionParent(function(a){return b.isMediumEditorElement(a)},a)},exportSelection:function(a,b){if(!a)return null;var c=null,d=b.getSelection();if(d.rangeCount>0){var e,f=d.getRangeAt(0),g=f.cloneRange();if(g.selectNodeContents(a),g.setEnd(f.startContainer,f.startOffset),e=g.toString().length,c={start:e,end:e+f.toString().length},0!==e){var h=this.getIndexRelativeToAdjacentEmptyBlocks(b,a,f.startContainer,f.startOffset);0!==h&&(c.emptyBlocksIndex=h)}}return c},importSelection:function(a,c,d,e){if(a&&c){var g=d.createRange();g.setStart(c,0),g.collapse(!0);for(var h,i=c,j=[],k=0,l=!1,m=!1;!m&&i;){if(3===i.nodeType)h=k+i.length,!l&&a.start>=k&&a.start<=h&&(g.setStart(i,a.start-k),l=!0),l&&a.end>=k&&a.end<=h&&(g.setEnd(i,a.end-k),m=!0),k=h;else for(var n=i.childNodes.length-1;n>=0;)j.push(i.childNodes[n]),n-=1;m||(i=j.pop())}if(a.emptyBlocksIndex&&a.end===h){for(var o=b.getTopBlockContainer(g.startContainer),p=0;p0)););g.setStart(b.getFirstSelectableLeafNode(o),0),g.collapse(!0)}e&&(g=f.importSelectionMoveCursorPastAnchor(a,g));var q=d.getSelection();q.removeAllRanges(),q.addRange(g)}},importSelectionMoveCursorPastAnchor:function(a,c){var d=function(a){return"a"===a.nodeName.toLowerCase()};if(a.start===a.end&&3===c.startContainer.nodeType&&c.startOffset===c.startContainer.nodeValue.length&&b.traverseUp(c.startContainer,d)){for(var e=c.startContainer,f=c.startContainer.parentNode;null!==f&&"a"!==f.nodeName.toLowerCase();)f.childNodes[f.childNodes.length-1]!==e?f=null:(e=f,f=f.parentNode);if(null!==f&&"a"===f.nodeName.toLowerCase()){for(var g=null,h=0;null===g&&h0)return 0;var g=e;if(3!==g.nodeType&&(g=e.childNodes[f]),g&&!b.isElementAtBeginningOfBlock(g))return 0;for(var h=c.createTreeWalker(d,NodeFilter.SHOW_ELEMENT,a,!1),i=0;h.nextNode();){var j=""===h.currentNode.textContent;if((j||i>0)&&(i+=1),b.isDescendant(h.currentNode,e,!0))return i;j||(i=0)}return i},selectionInContentEditableFalse:function(a){var b,c=this.findMatchingSelectionParent(function(a){var c=a&&a.getAttribute("contenteditable");return"true"===c&&(b=!0),"#text"!==a.nodeName&&"false"===c},a);return!b&&c},getSelectionHtml:function(a){var b,c,d,e="",f=a.getSelection();if(f.rangeCount){for(d=a.createElement("div"),b=0,c=f.rangeCount;c>b;b+=1)d.appendChild(f.getRangeAt(b).cloneContents());e=d.innerHTML}return e},getCaretOffsets:function(a,b){var c,d;return b||(b=window.getSelection().getRangeAt(0)),c=b.cloneRange(),d=b.cloneRange(),c.selectNodeContents(a),c.setEnd(b.endContainer,b.endOffset),d.selectNodeContents(a),d.setStart(b.endContainer,b.endOffset),{left:c.toString().length,right:d.toString().length}},rangeSelectsSingleNode:function(a){var b=a.startContainer;return b===a.endContainer&&b.hasChildNodes()&&a.endOffset===a.startOffset+1},getSelectedParentElement:function(a){return a?this.rangeSelectsSingleNode(a)&&3!==a.startContainer.childNodes[a.startOffset].nodeType?a.startContainer.childNodes[a.startOffset]:3===a.startContainer.nodeType?a.startContainer.parentNode:a.startContainer:null},getSelectedElements:function(a){var b,c,d,e=a.getSelection();if(!e.rangeCount||e.isCollapsed||!e.getRangeAt(0).commonAncestorContainer)return[];if(b=e.getRangeAt(0),3===b.commonAncestorContainer.nodeType){for(c=[],d=b.commonAncestorContainer;d.parentNode&&1===d.parentNode.childNodes.length;)c.push(d.parentNode),d=d.parentNode;return c}return[].filter.call(b.commonAncestorContainer.getElementsByTagName("*"),function(a){return"function"==typeof e.containsNode?e.containsNode(a,!0):!0})},selectNode:function(a,b){var c=b.createRange(),d=b.getSelection();c.selectNodeContents(a),d.removeAllRanges(),d.addRange(c)},select:function(a,b,c,d,e){a.getSelection().removeAllRanges();var f=a.createRange();return f.setStart(b,c),d?f.setEnd(d,e):f.collapse(!0),a.getSelection().addRange(f),f},moveCursor:function(a,b,c){this.select(a,b,c)},getSelectionRange:function(a){var b=a.getSelection();return 0===b.rangeCount?null:b.getRangeAt(0)},getSelectionStart:function(a){var b=a.getSelection().anchorNode,c=b&&3===b.nodeType?b.parentNode:b;return c}}}();var g;!function(){g=function(a){this.base=a,this.options=this.base.options,this.events=[],this.customEvents={},this.listeners={}},g.prototype={InputEventOnContenteditableSupported:!b.isIE,attachDOMEvent:function(a,b,c,d){a.addEventListener(b,c,d),this.events.push([a,b,c,d])},detachDOMEvent:function(a,b,c,d){var e,f=this.indexOfListener(a,b,c,d);-1!==f&&(e=this.events.splice(f,1)[0],e[0].removeEventListener(e[1],e[2],e[3]))},indexOfListener:function(a,b,c,d){var e,f,g;for(e=0,f=this.events.length;f>e;e+=1)if(g=this.events[e],g[0]===a&&g[1]===b&&g[2]===c&&g[3]===d)return e;return-1},detachAllDOMEvents:function(){for(var a=this.events.pop();a;)a[0].removeEventListener(a[1],a[2],a[3]),a=this.events.pop()},attachCustomEvent:function(a,b){this.setupListener(a),this.customEvents[a]||(this.customEvents[a]=[]),this.customEvents[a].push(b)},detachCustomEvent:function(a,b){var c=this.indexOfCustomListener(a,b);-1!==c&&this.customEvents[a].splice(c,1)},indexOfCustomListener:function(a,b){return this.customEvents[a]&&this.customEvents[a].length?this.customEvents[a].indexOf(b):-1},detachAllCustomEvents:function(){this.customEvents={}},triggerCustomEvent:function(a,b,c){this.customEvents[a]&&this.customEvents[a].forEach(function(a){a(b,c)})},destroy:function(){this.detachAllDOMEvents(),this.detachAllCustomEvents(),this.detachExecCommand(),this.base.elements&&this.base.elements.forEach(function(a){a.removeAttribute("data-medium-focused")})},attachToExecCommand:function(){this.execCommandListener||(this.execCommandListener=function(a){this.handleDocumentExecCommand(a)}.bind(this),this.wrapExecCommand(),this.options.ownerDocument.execCommand.listeners.push(this.execCommandListener))},detachExecCommand:function(){var a=this.options.ownerDocument;if(this.execCommandListener&&a.execCommand.listeners){var b=a.execCommand.listeners.indexOf(this.execCommandListener);-1!==b&&a.execCommand.listeners.splice(b,1),a.execCommand.listeners.length||this.unwrapExecCommand()}},wrapExecCommand:function(){var a=this.options.ownerDocument;if(!a.execCommand.listeners){var b=function(b,c,d){var e=a.execCommand.orig.apply(this,arguments);if(!a.execCommand.listeners)return e;var f=Array.prototype.slice.call(arguments);return a.execCommand.listeners.forEach(function(a){a({command:b,value:d,args:f,result:e})}),e};b.orig=a.execCommand,b.listeners=[],a.execCommand=b}},unwrapExecCommand:function(){var a=this.options.ownerDocument;a.execCommand.orig&&(a.execCommand=a.execCommand.orig)},setupListener:function(a){if(!this.listeners[a]){switch(a){case"externalInteraction":this.attachDOMEvent(this.options.ownerDocument.body,"mousedown",this.handleBodyMousedown.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"click",this.handleBodyClick.bind(this),!0),this.attachDOMEvent(this.options.ownerDocument.body,"focus",this.handleBodyFocus.bind(this),!0);break;case"blur":this.setupListener("externalInteraction");break;case"focus":this.setupListener("externalInteraction");break;case"editableInput":this.contentCache=[],this.base.elements.forEach(function(a){this.contentCache[a.getAttribute("medium-editor-index")]=a.innerHTML,this.InputEventOnContenteditableSupported&&this.attachDOMEvent(a,"input",this.handleInput.bind(this))}.bind(this)),this.InputEventOnContenteditableSupported||(this.setupListener("editableKeypress"),this.keypressUpdateInput=!0,this.attachDOMEvent(document,"selectionchange",this.handleDocumentSelectionChange.bind(this)),this.attachToExecCommand());break;case"editableClick":this.attachToEachElement("click",this.handleClick);break;case"editableBlur":this.attachToEachElement("blur",this.handleBlur);break;case"editableKeypress":this.attachToEachElement("keypress",this.handleKeypress);break;case"editableKeyup":this.attachToEachElement("keyup",this.handleKeyup);break;case"editableKeydown":this.attachToEachElement("keydown",this.handleKeydown);break;case"editableKeydownEnter":this.setupListener("editableKeydown");break;case"editableKeydownTab":this.setupListener("editableKeydown");break;case"editableKeydownDelete":this.setupListener("editableKeydown");break;case"editableMouseover":this.attachToEachElement("mouseover",this.handleMouseover);break;case"editableDrag":this.attachToEachElement("dragover",this.handleDragging),this.attachToEachElement("dragleave",this.handleDragging);break;case"editableDrop":this.attachToEachElement("drop",this.handleDrop);break;case"editablePaste":this.attachToEachElement("paste",this.handlePaste)}this.listeners[a]=!0}},attachToEachElement:function(a,b){this.base.elements.forEach(function(c){this.attachDOMEvent(c,a,b.bind(this))},this)},focusElement:function(a){a.focus(),this.updateFocus(a,{target:a,type:"focus"})},updateFocus:function(a,c){var d,e=this.base.getExtensionByName("toolbar"),f=e?e.getToolbarElement():null,g=this.base.getExtensionByName("anchor-preview"),h=g&&g.getPreviewElement?g.getPreviewElement():null,i=this.base.getFocusedElement();i&&"click"===c.type&&this.lastMousedownTarget&&(b.isDescendant(i,this.lastMousedownTarget,!0)||b.isDescendant(f,this.lastMousedownTarget,!0)||b.isDescendant(h,this.lastMousedownTarget,!0))&&(d=i),d||this.base.elements.some(function(c){return!d&&b.isDescendant(c,a,!0)&&(d=c),!!d},this);var j=!b.isDescendant(i,a,!0)&&!b.isDescendant(f,a,!0)&&!b.isDescendant(h,a,!0);d!==i&&(i&&j&&(i.removeAttribute("data-medium-focused"),this.triggerCustomEvent("blur",c,i)),d&&(d.setAttribute("data-medium-focused",!0),this.triggerCustomEvent("focus",c,d))),j&&this.triggerCustomEvent("externalInteraction",c)},updateInput:function(a,b){if(this.contentCache){var c=a.getAttribute("medium-editor-index");a.innerHTML!==this.contentCache[c]&&this.triggerCustomEvent("editableInput",b,a),this.contentCache[c]=a.innerHTML}},handleDocumentSelectionChange:function(a){if(a.currentTarget&&a.currentTarget.activeElement){var c,d=a.currentTarget.activeElement;this.base.elements.some(function(a){return b.isDescendant(a,d,!0)?(c=a,!0):!1},this),c&&this.updateInput(c,{target:d,currentTarget:c})}},handleDocumentExecCommand:function(){var a=this.base.getFocusedElement();a&&this.updateInput(a,{target:a,currentTarget:a})},handleBodyClick:function(a){this.updateFocus(a.target,a)},handleBodyFocus:function(a){this.updateFocus(a.target,a)},handleBodyMousedown:function(a){this.lastMousedownTarget=a.target},handleInput:function(a){this.updateInput(a.currentTarget,a)},handleClick:function(a){this.triggerCustomEvent("editableClick",a,a.currentTarget)},handleBlur:function(a){this.triggerCustomEvent("editableBlur",a,a.currentTarget)},handleKeypress:function(a){if(this.triggerCustomEvent("editableKeypress",a,a.currentTarget),this.keypressUpdateInput){var b={target:a.target,currentTarget:a.currentTarget};setTimeout(function(){this.updateInput(b.currentTarget,b)}.bind(this),0)}},handleKeyup:function(a){this.triggerCustomEvent("editableKeyup",a,a.currentTarget)},handleMouseover:function(a){this.triggerCustomEvent("editableMouseover",a,a.currentTarget)},handleDragging:function(a){this.triggerCustomEvent("editableDrag",a,a.currentTarget)},handleDrop:function(a){this.triggerCustomEvent("editableDrop",a,a.currentTarget)},handlePaste:function(a){this.triggerCustomEvent("editablePaste",a,a.currentTarget)},handleKeydown:function(a){return this.triggerCustomEvent("editableKeydown",a,a.currentTarget),b.isKey(a,b.keyCode.ENTER)?this.triggerCustomEvent("editableKeydownEnter",a,a.currentTarget):b.isKey(a,b.keyCode.TAB)?this.triggerCustomEvent("editableKeydownTab",a,a.currentTarget):b.isKey(a,[b.keyCode.DELETE,b.keyCode.BACKSPACE])?this.triggerCustomEvent("editableKeydownDelete",a,a.currentTarget):void 0}}}();var h;!function(){h=e.extend({action:void 0,aria:void 0,tagNames:void 0,style:void 0,useQueryState:void 0,contentDefault:void 0,contentFA:void 0,classList:void 0,attrs:void 0,defaults:c,constructor:function(a){h.isBuiltInButton(a)?e.call(this,this.defaults[a]):e.call(this,a)},init:function(){e.prototype.init.apply(this,arguments),this.button=this.createButton(),this.on(this.button,"click",this.handleClick.bind(this))},getButton:function(){return this.button},getAction:function(){return"function"==typeof this.action?this.action(this.base.options):this.action},getAria:function(){return"function"==typeof this.aria?this.aria(this.base.options):this.aria},getTagNames:function(){return"function"==typeof this.tagNames?this.tagNames(this.base.options):this.tagNames},createButton:function(){var a=this.document.createElement("button"),b=this.contentDefault,c=this.getAria(),d=this.getEditorOption("buttonLabels");
return a.classList.add("medium-editor-action"),a.classList.add("medium-editor-action-"+this.name),this.classList&&this.classList.forEach(function(b){a.classList.add(b)}),a.setAttribute("data-action",this.getAction()),c&&(a.setAttribute("title",c),a.setAttribute("aria-label",c)),this.attrs&&Object.keys(this.attrs).forEach(function(b){a.setAttribute(b,this.attrs[b])},this),"fontawesome"===d&&this.contentFA&&(b=this.contentFA),a.innerHTML=b,a},handleClick:function(a){a.preventDefault(),a.stopPropagation();var b=this.getAction();b&&this.execAction(b)},isActive:function(){return this.button.classList.contains(this.getEditorOption("activeButtonClass"))},setInactive:function(){this.button.classList.remove(this.getEditorOption("activeButtonClass")),delete this.knownState},setActive:function(){this.button.classList.add(this.getEditorOption("activeButtonClass")),delete this.knownState},queryCommandState:function(){var a=null;return this.useQueryState&&(a=this.base.queryCommandState(this.getAction())),a},isAlreadyApplied:function(a){var b,c,d=!1,e=this.getTagNames();return this.knownState===!1||this.knownState===!0?this.knownState:(e&&e.length>0&&(d=-1!==e.indexOf(a.nodeName.toLowerCase())),!d&&this.style&&(b=this.style.value.split("|"),c=this.window.getComputedStyle(a,null).getPropertyValue(this.style.prop),b.forEach(function(a){this.knownState||(d=-1!==c.indexOf(a),(d||"text-decoration"!==this.style.prop)&&(this.knownState=d))},this)),d)}}),h.isBuiltInButton=function(a){return"string"==typeof a&&h.prototype.defaults.hasOwnProperty(a)}}();var i;!function(){var a=function(){};i=h.extend({init:function(){h.prototype.init.apply(this,arguments)},formSaveLabel:"✓",formCloseLabel:"×",hasForm:!0,getForm:a,isDisplayed:a,hideForm:a,showToolbarDefaultActions:function(){var a=this.base.getExtensionByName("toolbar");a&&a.showToolbarDefaultActions()},hideToolbarDefaultActions:function(){var a=this.base.getExtensionByName("toolbar");a&&a.hideToolbarDefaultActions()},setToolbarPosition:function(){var a=this.base.getExtensionByName("toolbar");a&&a.setToolbarPosition()}})}();var j;!function(){j=i.extend({customClassOption:null,customClassOptionText:"Button",linkValidation:!1,placeholderText:"Paste or type a link",targetCheckbox:!1,targetCheckboxText:"Open in new window",name:"anchor",action:"createLink",aria:"link",tagNames:["a"],contentDefault:"#",contentFA:'',init:function(){i.prototype.init.apply(this,arguments),this.subscribe("editableKeydown",this.handleKeydown.bind(this))},handleClick:function(a){a.preventDefault(),a.stopPropagation();var c=f.getSelectedParentElement(f.getSelectionRange(this.document)),d=b.getFirstTextNode(c);return b.getClosestTag(d,"a")?this.execAction("unlink"):(this.isDisplayed()||this.showForm(),!1)},handleKeydown:function(a){b.isKey(a,b.keyCode.K)&&b.isMetaCtrlKey(a)&&!a.shiftKey&&this.handleClick(a)},getForm:function(){return this.form||(this.form=this.createForm()),this.form},getTemplate:function(){var a=[''];return a.push('',"fontawesome"===this.getEditorOption("buttonLabels")?'':this.formSaveLabel,""),a.push('',"fontawesome"===this.getEditorOption("buttonLabels")?'':this.formCloseLabel,""),this.targetCheckbox&&a.push('