summernote-rails 0.2.1.3 → 0.2.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca46781971a97cbd650d7deb6c85a182d54cb2be
4
- data.tar.gz: aba31acaa4d25961214172901a94d9abf831f722
3
+ metadata.gz: 9ee94f9fdfe922203de9d0b758f252d6ad6bd38d
4
+ data.tar.gz: bc78ce03d54b494942a61a0c64b57d560beb5fc3
5
5
  SHA512:
6
- metadata.gz: 1dfbea5b0622b0a12f9e84c4706d3a4630c31368279ec7d49bb0c4fe85c4d911b2302088fc571e69a8d7aa35ded9d08d0fb212ebc49e9ebee05845a420a4e2ed
7
- data.tar.gz: 130eec35a7f17d8f140d634013cc05701b7849e0e2d62b33d87ce3d00acc7c0df5d4aa00ed56d899d1a6e15d1e87131040be390e53b73d6b3bf786bd737606fb
6
+ metadata.gz: cd84e5fa5e1df54218e1ae12769e58c3e4bdb6d9b1450d6bce770f697999065883fc369884af79c1cb85ea14f4426455a9709f65f8a828e08776d757ae92dabd
7
+ data.tar.gz: ec63118f5a9056cf51f57085e4586066fb6adf2aadc124cb62c33bf7f25063b62b3ab1f642972bf2a7d4b7d1601779211eae1d86afa83411d69b8b9898559958
data/README.md CHANGED
@@ -94,6 +94,17 @@ $ ->
94
94
  summer_note.summernote
95
95
  # to set options
96
96
  height:300
97
+ toolbar: [
98
+ # ['insert', ['picture', 'link']], // no insert buttons
99
+ ["table", ["table"]],
100
+ ["style", ["style"]],
101
+ ["fontsize", ["fontsize"]],
102
+ ["color", ["color"]],
103
+ ["style", ["bold", "italic", "underline", "clear"]],
104
+ ["para", ["ul", "ol", "paragraph"]],
105
+ ["height", ["height"]],
106
+ ["help", ["help"]]
107
+ ]
97
108
 
98
109
  # to set code for summernote
99
110
  summer_note.code summer_note.val()
@@ -115,6 +126,7 @@ That's it.
115
126
 
116
127
  ## Changelogs
117
128
 
129
+ - v0.2.1.4 : Enable to customize Toolbar Collection
118
130
  - v0.2.1.3 : Added Help button in editor toolbox to popup Hot Key Table
119
131
  - v0.2.1.2 : Added InsertHorizontalRule(Cmd+Enter) in summernote editor /
120
132
  Added summernote.js
@@ -1,5 +1,5 @@
1
1
  module Summernote
2
2
  module Rails
3
- VERSION = "0.2.1.3"
3
+ VERSION = "0.2.1.4"
4
4
  end
5
5
  end
@@ -602,7 +602,7 @@
602
602
  welFontsize.find('.note-current-fontsize').html(oStyle['font-size']);
603
603
  checkDropdownMenu(welFontsize, parseFloat(oStyle['font-size']));
604
604
 
605
- var welLineHeight = welToolbar.find('.note-line-height');
605
+ var welLineHeight = welToolbar.find('.note-height');
606
606
  checkDropdownMenu(welLineHeight, parseFloat(oStyle['line-height']));
607
607
 
608
608
  //check button state
@@ -785,7 +785,7 @@
785
785
  var handle = new Handle(), dialog = new Dialog();
786
786
 
787
787
  var key = { BACKSPACE: 8, TAB: 9, ENTER: 13, SPACE: 32,
788
- NUM0: 48, NUM1: 49, NUM4: 52, NUM7: 55, NUM8: 56,
788
+ NUM0: 48, NUM1: 49, NUM6: 54, NUM7: 55, NUM8: 56,
789
789
  B: 66, E: 69, I: 73, J: 74, K: 75, L: 76, R: 82,
790
790
  U: 85, Y: 89, Z: 90, BACKSLACH: 220 };
791
791
 
@@ -844,8 +844,8 @@
844
844
  editor.tab(oLayoutInfo.editable());
845
845
  } else if (bCmd && keyCode === key.NUM0) { // formatBlock Paragraph
846
846
  editor.formatBlock(oLayoutInfo.editable(), 'P');
847
- } else if (bCmd && (key.NUM1 <= keyCode && keyCode <= key.NUM4)) {
848
- var sHeading = 'H' + String.fromCharCode(keyCode); // H1~H4
847
+ } else if (bCmd && (key.NUM1 <= keyCode && keyCode <= key.NUM6)) {
848
+ var sHeading = 'H' + String.fromCharCode(keyCode); // H1~H6
849
849
  editor.formatBlock(oLayoutInfo.editable(), sHeading);
850
850
  } else if (bCmd && keyCode === key.ENTER) {
851
851
  editor.insertHorizontalRule(oLayoutInfo.editable());
@@ -1008,7 +1008,7 @@
1008
1008
  welDimensionDisplay.html(dim.c + ' x ' + dim.r);
1009
1009
  };
1010
1010
 
1011
- this.attach = function(oLayoutInfo) {
1011
+ this.attach = function(oLayoutInfo, options) {
1012
1012
  oLayoutInfo.editable.on('keydown', hKeydown);
1013
1013
  oLayoutInfo.editable.on('mousedown', hMousedown);
1014
1014
  oLayoutInfo.editable.on('keyup mouseup', hToolbarAndPopoverUpdate);
@@ -1028,6 +1028,21 @@
1028
1028
  var welToolbar = oLayoutInfo.toolbar;
1029
1029
  var welCatcher = welToolbar.find('.note-dimension-picker-mousecatcher');
1030
1030
  welCatcher.on('mousemove', hDimensionPickerMove);
1031
+
1032
+ // callback
1033
+ // init, enter, !change, !pasteBefore, !pasteAfter, focus, blur, keyup, keydown
1034
+ if (options.onenter) {
1035
+ oLayoutInfo.editable.keypress(function(event) {
1036
+ if (event.keyCode === key.ENTER) { options.onenter(event);}
1037
+ });
1038
+ }
1039
+ if (options.onfocus) { oLayoutInfo.editable.focus(options.onfocus); }
1040
+ if (options.onblur) { oLayoutInfo.editable.blur(options.onblur); }
1041
+ if (options.onkeyup) { oLayoutInfo.editable.blur(options.onkeyup); }
1042
+ if (options.onkeydown) { oLayoutInfo.editable.blur(options.onkeydown); }
1043
+
1044
+ // TODO: callback for advanced features
1045
+ // autosave, impageUpload, imageUploadError, fileUpload, fileUploadError
1031
1046
  };
1032
1047
 
1033
1048
  this.dettach = function(oLayoutInfo) {
@@ -1044,108 +1059,108 @@
1044
1059
  * rendering toolbar and editable
1045
1060
  */
1046
1061
  var Renderer = function() {
1047
- var sToolbar = '<div class="note-toolbar btn-toolbar">' +
1048
- '<div class="note-insert btn-group">' +
1049
- '<button type="button" class="btn btn-small" title="Picture" data-event="showImageDialog" tabindex="-1"><i class="icon-picture"></i></button>' +
1050
- '<button type="button" class="btn btn-small" title="Link" data-event="showLinkDialog" data-shortcut="Ctrl+K" data-mac-shortcut="⌘+K" tabindex="-1"><i class="icon-link"></i></button>' +
1051
- '</div>' +
1052
- '<div class="note-table btn-group">' +
1053
- '<button type="button" class="btn btn-small dropdown-toggle" title="Table" data-toggle="dropdown" tabindex="-1"><i class="icon-table"></i> <span class="caret"></span></button>' +
1054
- '<ul class="dropdown-menu">' +
1055
- '<div class="note-dimension-picker">' +
1056
- '<div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div>' +
1057
- '<div class="note-dimension-picker-highlighted"></div>' +
1058
- '<div class="note-dimension-picker-unhighlighted"></div>' +
1059
- '</div>' +
1060
- '<div class="note-dimension-display"> 1 x 1 </div>' +
1061
- '</ul>' +
1062
- '</div>' +
1063
- '<div class="note-style btn-group">' +
1064
- '<button type="button" class="btn btn-small dropdown-toggle" title="Style" data-toggle="dropdown" tabindex="-1"><i class="icon-magic"></i> <span class="caret"></span></button>' +
1065
- '<ul class="dropdown-menu">' +
1066
- '<li><a data-event="formatBlock" data-value="p">Paragraph</a></li>' +
1067
- '<li><a data-event="formatBlock" data-value="blockquote"><blockquote>Quote</blockquote></a></li>' +
1068
- '<li><a data-event="formatBlock" data-value="pre">Code</a></li>' +
1069
- '<li><a data-event="formatBlock" data-value="h1"><h1>Header 1</h1></a></li>' +
1070
- '<li><a data-event="formatBlock" data-value="h2"><h2>Header 2</h2></a></li>' +
1071
- '<li><a data-event="formatBlock" data-value="h3"><h3>Header 3</h3></a></li>' +
1072
- '<li><a data-event="formatBlock" data-value="h4"><h4>Header 4</h4></a></li>' +
1073
- '</ul>' +
1074
- '</div>' +
1075
- '<div class="note-fontsize btn-group">' +
1076
- '<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Font Size" tabindex="-1"><span class="note-current-fontsize">11</span> <b class="caret"></b></button>' +
1077
- '<ul class="dropdown-menu">' +
1078
- '<li><a data-event="fontSize" data-value="8"><i class="icon-ok"></i> 8</a></li>' +
1079
- '<li><a data-event="fontSize" data-value="9"><i class="icon-ok"></i> 9</a></li>' +
1080
- '<li><a data-event="fontSize" data-value="10"><i class="icon-ok"></i> 10</a></li>' +
1081
- '<li><a data-event="fontSize" data-value="11"><i class="icon-ok"></i> 11</a></li>' +
1082
- '<li><a data-event="fontSize" data-value="12"><i class="icon-ok"></i> 12</a></li>' +
1083
- '<li><a data-event="fontSize" data-value="14"><i class="icon-ok"></i> 14</a></li>' +
1084
- '<li><a data-event="fontSize" data-value="18"><i class="icon-ok"></i> 18</a></li>' +
1085
- '<li><a data-event="fontSize" data-value="24"><i class="icon-ok"></i> 24</a></li>' +
1086
- '<li><a data-event="fontSize" data-value="36"><i class="icon-ok"></i> 36</a></li>' +
1087
- '</ul>' +
1088
- '</div>' +
1089
- '<div class="note-color btn-group">' +
1090
- '<button type="button" class="btn btn-small note-recent-color" title="Recent Color" data-event="color" data-value=\'{"foreColor":"black","backColor":"yellow"}\' tabindex="-1"><i class="icon-font" style="color:black;background-color:yellow;"></i></button>' +
1091
- '<button type="button" class="btn btn-small dropdown-toggle" title="More Color" data-toggle="dropdown" tabindex="-1">' +
1092
- '<span class="caret"></span>' +
1093
- '</button>' +
1094
- '<ul class="dropdown-menu">' +
1095
- '<li>' +
1096
- '<div class="btn-group">' +
1097
- '<div class="note-palette-title">BackColor</div>' +
1098
- '<div class="note-color-palette" data-target-event="backColor"></div>' +
1099
- '</div>' +
1100
- '<div class="btn-group">' +
1101
- '<div class="note-palette-title">FontColor</div>' +
1102
- '<div class="note-color-palette" data-target-event="foreColor"></div>' +
1103
- '</div>' +
1104
- '</li>' +
1105
- '</ul>' +
1106
- '</div>' +
1107
- '<div class="note-style btn-group">' +
1108
- '<button type="button" class="btn btn-small" title="Bold" data-shortcut="Ctrl+B" data-mac-shortcut="⌘+B" data-event="bold" tabindex="-1"><i class="icon-bold"></i></button>' +
1109
- '<button type="button" class="btn btn-small" title="Italic" data-shortcut="Ctrl+I" data-mac-shortcut="⌘+I" data-event="italic" tabindex="-1"><i class="icon-italic"></i></button>' +
1110
- '<button type="button" class="btn btn-small" title="Underline" data-shortcut="Ctrl+U" data-mac-shortcut="⌘+U" data-event="underline" tabindex="-1"><i class="icon-underline"></i></button>' +
1111
- '<button type="button" class="btn btn-small" title="Remove Font Style" data-shortcut="Ctrl+\\" data-mac-shortcut="⌘+\\" data-event="removeFormat" tabindex="-1"><i class="icon-eraser"></i></button>' +
1112
- '</div>' +
1113
- '<div class="note-para btn-group">' +
1114
- '<button type="button" class="btn btn-small" title="Unordered list" data-shortcut="Ctrl+Shift+8" data-mac-shortcut="⌘+⇧+7" data-event="insertUnorderedList" tabindex="-1"><i class="icon-list-ul"></i></button>' +
1115
- '<button type="button" class="btn btn-small" title="Ordered list" data-shortcut="Ctrl+Shift+7" data-mac-shortcut="⌘+⇧+8" data-event="insertOrderedList" tabindex="-1"><i class="icon-list-ol"></i></button>' +
1116
- '<button type="button" class="btn btn-small dropdown-toggle" title="Paragraph" data-toggle="dropdown" tabindex="-1"><i class="icon-align-left"></i> <span class="caret"></span></button>' +
1117
- '<ul class="dropdown-menu right">' +
1118
- '<li>' +
1119
- '<div class="note-align btn-group">' +
1120
- '<button type="button" class="btn btn-small" title="Align left" data-shortcut="Ctrl+Shift+L" data-mac-shortcut="⌘+⇧+L" data-event="justifyLeft" tabindex="-1"><i class="icon-align-left"></i></button>' +
1121
- '<button type="button" class="btn btn-small" title="Align center" data-shortcut="Ctrl+Shift+E" data-mac-shortcut="⌘+⇧+E" data-event="justifyCenter" tabindex="-1"><i class="icon-align-center"></i></button>' +
1122
- '<button type="button" class="btn btn-small" title="Align right" data-shortcut="Ctrl+Shift+R" data-mac-shortcut="⌘+⇧+R" data-event="justifyRight" tabindex="-1"><i class="icon-align-right"></i></button>' +
1123
- '<button type="button" class="btn btn-small" title="Justify full" data-shortcut="Ctrl+Shift+J" data-mac-shortcut="⌘+⇧+J" data-event="justifyFull" tabindex="-1"><i class="icon-align-justify"></i></button>' +
1124
- '</div>' +
1125
- '</li>' +
1126
- '<li>' +
1127
- '<div class="note-list btn-group">' +
1128
- '<button type="button" class="btn btn-small" title="Outdent" data-shortcut="Shift+TAB" data-mac-shortcut="⇧+TAB" data-event="outdent" tabindex="-1"><i class="icon-indent-left"></i></button>' +
1129
- '<button type="button" class="btn btn-small" title="Indent" data-shortcut="TAB" data-mac-shortcut="TAB" data-event="indent" tabindex="-1"><i class="icon-indent-right"></i></button>' +
1130
- '</li>' +
1131
- '</ul>' +
1132
- '</div>' +
1133
- '<div class="note-line-height btn-group">' +
1134
- '<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Line Height" tabindex="-1"><i class="icon-text-height"></i>&nbsp; <b class="caret"></b></button>' +
1135
- '<ul class="dropdown-menu right">' +
1136
- '<li><a data-event="lineHeight" data-value="1.0"><i class="icon-ok"></i> 1.0</a></li>' +
1137
- '<li><a data-event="lineHeight" data-value="1.2"><i class="icon-ok"></i> 1.2</a></li>' +
1138
- '<li><a data-event="lineHeight" data-value="1.4"><i class="icon-ok"></i> 1.4</a></li>' +
1139
- '<li><a data-event="lineHeight" data-value="1.5"><i class="icon-ok"></i> 1.5</a></li>' +
1140
- '<li><a data-event="lineHeight" data-value="1.6"><i class="icon-ok"></i> 1.6</a></li>' +
1141
- '<li><a data-event="lineHeight" data-value="1.8"><i class="icon-ok"></i> 1.8</a></li>' +
1142
- '<li><a data-event="lineHeight" data-value="2.0"><i class="icon-ok"></i> 2.0</a></li>' +
1143
- '<li><a data-event="lineHeight" data-value="3.0"><i class="icon-ok"></i> 3.0</a></li>' +
1144
- '</ul>' +
1145
- '</div>' +
1146
- '<div class="note-help btn-group">' +
1147
- '<button type="button" class="btn btn-small" title="Help" data-event="showHelpDialog" tabindex="-1"><i class="icon-question"></i></button>' +
1148
- '</div>';
1062
+ var aToolbarItem = {
1063
+ picture:
1064
+ '<button type="button" class="btn btn-small" title="Picture" data-event="showImageDialog" tabindex="-1"><i class="icon-picture"></i></button>',
1065
+ link:
1066
+ '<button type="button" class="btn btn-small" title="Link" data-event="showLinkDialog" data-shortcut="Ctrl+K" data-mac-shortcut="⌘+K" tabindex="-1"><i class="icon-link"></i></button>',
1067
+ table:
1068
+ '<button type="button" class="btn btn-small dropdown-toggle" title="Table" data-toggle="dropdown" tabindex="-1"><i class="icon-table"></i> <span class="caret"></span></button>' +
1069
+ '<ul class="dropdown-menu">' +
1070
+ '<div class="note-dimension-picker">' +
1071
+ '<div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div>' +
1072
+ '<div class="note-dimension-picker-highlighted"></div>' +
1073
+ '<div class="note-dimension-picker-unhighlighted"></div>' +
1074
+ '</div>' +
1075
+ '<div class="note-dimension-display"> 1 x 1 </div>' +
1076
+ '</ul>',
1077
+ style:
1078
+ '<button type="button" class="btn btn-small dropdown-toggle" title="Style" data-toggle="dropdown" tabindex="-1"><i class="icon-magic"></i> <span class="caret"></span></button>' +
1079
+ '<ul class="dropdown-menu">' +
1080
+ '<li><a data-event="formatBlock" data-value="p">Normal</a></li>' +
1081
+ '<li><a data-event="formatBlock" data-value="blockquote"><blockquote>Quote</blockquote></a></li>' +
1082
+ '<li><a data-event="formatBlock" data-value="pre">Code</a></li>' +
1083
+ '<li><a data-event="formatBlock" data-value="h1"><h1>Header 1</h1></a></li>' +
1084
+ '<li><a data-event="formatBlock" data-value="h2"><h2>Header 2</h2></a></li>' +
1085
+ '<li><a data-event="formatBlock" data-value="h3"><h3>Header 3</h3></a></li>' +
1086
+ '<li><a data-event="formatBlock" data-value="h4"><h4>Header 4</h4></a></li>' +
1087
+ '<li><a data-event="formatBlock" data-value="h5"><h5>Header 5</h5></a></li>' +
1088
+ '<li><a data-event="formatBlock" data-value="h6"><h6>Header 6</h6></a></li>' +
1089
+ '</ul>',
1090
+ fontsize:
1091
+ '<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Font Size" tabindex="-1"><span class="note-current-fontsize">11</span> <b class="caret"></b></button>' +
1092
+ '<ul class="dropdown-menu">' +
1093
+ '<li><a data-event="fontSize" data-value="8"><i class="icon-ok"></i> 8</a></li>' +
1094
+ '<li><a data-event="fontSize" data-value="9"><i class="icon-ok"></i> 9</a></li>' +
1095
+ '<li><a data-event="fontSize" data-value="10"><i class="icon-ok"></i> 10</a></li>' +
1096
+ '<li><a data-event="fontSize" data-value="11"><i class="icon-ok"></i> 11</a></li>' +
1097
+ '<li><a data-event="fontSize" data-value="12"><i class="icon-ok"></i> 12</a></li>' +
1098
+ '<li><a data-event="fontSize" data-value="14"><i class="icon-ok"></i> 14</a></li>' +
1099
+ '<li><a data-event="fontSize" data-value="18"><i class="icon-ok"></i> 18</a></li>' +
1100
+ '<li><a data-event="fontSize" data-value="24"><i class="icon-ok"></i> 24</a></li>' +
1101
+ '<li><a data-event="fontSize" data-value="36"><i class="icon-ok"></i> 36</a></li>' +
1102
+ '</ul>',
1103
+ color:
1104
+ '<button type="button" class="btn btn-small note-recent-color" title="Recent Color" data-event="color" data-value=\'{"foreColor":"black","backColor":"yellow"}\' tabindex="-1"><i class="icon-font" style="color:black;background-color:yellow;"></i></button>' +
1105
+ '<button type="button" class="btn btn-small dropdown-toggle" title="More Color" data-toggle="dropdown" tabindex="-1">' +
1106
+ '<span class="caret"></span>' +
1107
+ '</button>' +
1108
+ '<ul class="dropdown-menu">' +
1109
+ '<li>' +
1110
+ '<div class="btn-group">' +
1111
+ '<div class="note-palette-title">BackColor</div>' +
1112
+ '<div class="note-color-palette" data-target-event="backColor"></div>' +
1113
+ '</div>' +
1114
+ '<div class="btn-group">' +
1115
+ '<div class="note-palette-title">FontColor</div>' +
1116
+ '<div class="note-color-palette" data-target-event="foreColor"></div>' +
1117
+ '</div>' +
1118
+ '</li>' +
1119
+ '</ul>',
1120
+ bold:
1121
+ '<button type="button" class="btn btn-small" title="Bold" data-shortcut="Ctrl+B" data-mac-shortcut="⌘+B" data-event="bold" tabindex="-1"><i class="icon-bold"></i></button>',
1122
+ italic:
1123
+ '<button type="button" class="btn btn-small" title="Italic" data-shortcut="Ctrl+I" data-mac-shortcut="⌘+I" data-event="italic" tabindex="-1"><i class="icon-italic"></i></button>',
1124
+ underline:
1125
+ '<button type="button" class="btn btn-small" title="Underline" data-shortcut="Ctrl+U" data-mac-shortcut="⌘+U" data-event="underline" tabindex="-1"><i class="icon-underline"></i></button>',
1126
+ clear:
1127
+ '<button type="button" class="btn btn-small" title="Remove Font Style" data-shortcut="Ctrl+\\" data-mac-shortcut="⌘+\\" data-event="removeFormat" tabindex="-1"><i class="icon-eraser"></i></button>',
1128
+ ul:
1129
+ '<button type="button" class="btn btn-small" title="Unordered list" data-shortcut="Ctrl+Shift+8" data-mac-shortcut="⌘+⇧+7" data-event="insertUnorderedList" tabindex="-1"><i class="icon-list-ul"></i></button>',
1130
+ ol:
1131
+ '<button type="button" class="btn btn-small" title="Ordered list" data-shortcut="Ctrl+Shift+7" data-mac-shortcut="⌘+⇧+8" data-event="insertOrderedList" tabindex="-1"><i class="icon-list-ol"></i></button>',
1132
+ paragraph:
1133
+ '<button type="button" class="btn btn-small dropdown-toggle" title="Paragraph" data-toggle="dropdown" tabindex="-1"><i class="icon-align-left"></i> <span class="caret"></span></button>' +
1134
+ '<ul class="dropdown-menu right">' +
1135
+ '<li>' +
1136
+ '<div class="note-align btn-group">' +
1137
+ '<button type="button" class="btn btn-small" title="Align left" data-shortcut="Ctrl+Shift+L" data-mac-shortcut="⌘+⇧+L" data-event="justifyLeft" tabindex="-1"><i class="icon-align-left"></i></button>' +
1138
+ '<button type="button" class="btn btn-small" title="Align center" data-shortcut="Ctrl+Shift+E" data-mac-shortcut="⌘+⇧+E" data-event="justifyCenter" tabindex="-1"><i class="icon-align-center"></i></button>' +
1139
+ '<button type="button" class="btn btn-small" title="Align right" data-shortcut="Ctrl+Shift+R" data-mac-shortcut="⌘+⇧+R" data-event="justifyRight" tabindex="-1"><i class="icon-align-right"></i></button>' +
1140
+ '<button type="button" class="btn btn-small" title="Justify full" data-shortcut="Ctrl+Shift+J" data-mac-shortcut="⌘+⇧+J" data-event="justifyFull" tabindex="-1"><i class="icon-align-justify"></i></button>' +
1141
+ '</div>' +
1142
+ '</li>' +
1143
+ '<li>' +
1144
+ '<div class="note-list btn-group">' +
1145
+ '<button type="button" class="btn btn-small" title="Outdent" data-shortcut="Shift+TAB" data-mac-shortcut="⇧+TAB" data-event="outdent" tabindex="-1"><i class="icon-indent-left"></i></button>' +
1146
+ '<button type="button" class="btn btn-small" title="Indent" data-shortcut="TAB" data-mac-shortcut="TAB" data-event="indent" tabindex="-1"><i class="icon-indent-right"></i></button>' +
1147
+ '</li>' +
1148
+ '</ul>',
1149
+ height:
1150
+ '<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Line Height" tabindex="-1"><i class="icon-text-height"></i>&nbsp; <b class="caret"></b></button>' +
1151
+ '<ul class="dropdown-menu right">' +
1152
+ '<li><a data-event="lineHeight" data-value="1.0"><i class="icon-ok"></i> 1.0</a></li>' +
1153
+ '<li><a data-event="lineHeight" data-value="1.2"><i class="icon-ok"></i> 1.2</a></li>' +
1154
+ '<li><a data-event="lineHeight" data-value="1.4"><i class="icon-ok"></i> 1.4</a></li>' +
1155
+ '<li><a data-event="lineHeight" data-value="1.5"><i class="icon-ok"></i> 1.5</a></li>' +
1156
+ '<li><a data-event="lineHeight" data-value="1.6"><i class="icon-ok"></i> 1.6</a></li>' +
1157
+ '<li><a data-event="lineHeight" data-value="1.8"><i class="icon-ok"></i> 1.8</a></li>' +
1158
+ '<li><a data-event="lineHeight" data-value="2.0"><i class="icon-ok"></i> 2.0</a></li>' +
1159
+ '<li><a data-event="lineHeight" data-value="3.0"><i class="icon-ok"></i> 3.0</a></li>' +
1160
+ '</ul>',
1161
+ help:
1162
+ '<button type="button" class="btn btn-small" title="Help" data-event="showHelpDialog" tabindex="-1"><i class="icon-question"></i></button>'
1163
+ };
1149
1164
  var sPopover = '<div class="note-popover">' +
1150
1165
  '<div class="note-link-popover popover fade bottom in" style="display: none;">' +
1151
1166
  '<div class="arrow"></div>' +
@@ -1186,122 +1201,155 @@
1186
1201
  '</div>' +
1187
1202
  '</div>';
1188
1203
 
1189
- var sShortcutTable = '<table class="table table-hover table-striped table-bordered">' +
1204
+ var sShortcutText = '<table class="note-shortcut">' +
1190
1205
  '<thead>' +
1191
1206
  '<tr>' +
1192
1207
  '<th></th>' +
1193
- '<th>Mac</th>' +
1194
- '<th>Windows</th>' +
1208
+ '<th>Text formatting</th>' +
1195
1209
  '</tr>' +
1196
1210
  '</thead>' +
1197
1211
  '<tbody>' +
1198
1212
  '<tr>' +
1199
- '<td>Undo</td>' +
1200
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">Z</button></td>' +
1201
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Z</button></td>' +
1202
- '</tr>' +
1203
- '<tr>' +
1204
- '<td>Redo</td>' +
1205
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">Z</button></td>' +
1206
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Y</button></td>' +
1213
+ '<td>⌘ + B</td>' +
1214
+ '<td>Bold</td>' +
1207
1215
  '</tr>' +
1208
1216
  '<tr>' +
1209
- '<td>Indent</td>' +
1210
- '<td><button class="btn btn-mini">Tab</button></td>' +
1211
- '<td><button class="btn btn-mini">Tab</button></td>' +
1217
+ '<td>⌘ + I</td>' +
1218
+ '<td>Italic</td>' +
1212
1219
  '</tr>' +
1213
1220
  '<tr>' +
1214
- '<td>Outdent</td>' +
1215
- '<td><button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">Tab</button></td>' +
1216
- '<td><button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">Tab</button></td>' +
1221
+ '<td>⌘ + U</td>' +
1222
+ '<td>Underline</td>' +
1217
1223
  '</tr>' +
1218
1224
  '<tr>' +
1219
- '<td>Bold</td>' +
1220
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">B</button></td>' +
1221
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">B</button></td>' +
1225
+ '<td>⌘ + \\</td>' +
1226
+ '<td>Remove Font Style</td>' +
1222
1227
  '</tr>' +
1223
- '<tr>' +
1224
- '<td>Italic</td>' +
1225
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">I</button></td>' +
1226
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">I</button></td>' +
1227
1228
  '</tr>' +
1229
+ '</tbody>' +
1230
+ '</table>';
1231
+
1232
+ var sShortcutAction = '<table class="note-shortcut">' +
1233
+ '<thead>' +
1228
1234
  '<tr>' +
1229
- '<td>Underline</td>' +
1230
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">U</button></td>' +
1231
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">U</button></td>' +
1235
+ '<th></th>' +
1236
+ '<th>Action</th>' +
1232
1237
  '</tr>' +
1238
+ '</thead>' +
1239
+ '<tbody>' +
1233
1240
  '<tr>' +
1234
- '<td>Remove Font Style</td>' +
1235
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">\\</button></td>' +
1236
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">\\</button></td>' +
1241
+ '<td>⌘ + Z</td>' +
1242
+ '<td>Undo</td>' +
1237
1243
  '</tr>' +
1238
1244
  '<tr>' +
1239
- '<td>Align Left</td>' +
1240
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">L</button></td>' +
1241
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">L</button></td>' +
1245
+ '<td>⌘ + ⇧ + Z</td>' +
1246
+ '<td>Redo</td>' +
1242
1247
  '</tr>' +
1243
1248
  '<tr>' +
1244
- '<td>Align Center</td>' +
1245
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">E</button></td>' +
1246
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">E</button></td>' +
1249
+ '<td>Tab</td>' +
1250
+ '<td>Indent</td>' +
1247
1251
  '</tr>' +
1248
1252
  '<tr>' +
1249
- '<td>Align Right</td>' +
1250
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">R</button></td>' +
1251
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">R</button></td>' +
1253
+ '<td>⇧ + Tab</td>' +
1254
+ '<td>Outdent</td>' +
1252
1255
  '</tr>' +
1253
1256
  '<tr>' +
1254
- '<td>Justify Full</td>' +
1255
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">J</button></td>' +
1256
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">J</button></td>' +
1257
+ '<td>⌘ + K</td>' +
1258
+ '<td>Insert Link</td>' +
1257
1259
  '</tr>' +
1258
1260
  '<tr>' +
1259
- '<td>Ordered List</td>' +
1260
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">NUM7</button></td>' +
1261
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">NUM7</button></td>' +
1261
+ '<td>⌘ + ENTER</td>' +
1262
+ '<td>Insert Horizontal Rule</td>' +
1262
1263
  '</tr>' +
1264
+ '</tbody>' +
1265
+ '</table>';
1266
+
1267
+ var sShortcutPara = '<table class="note-shortcut">' +
1268
+ '<thead>' +
1269
+ '<tr>' +
1270
+ '<th></th>' +
1271
+ '<th>Paragraph formatting</th>' +
1272
+ '</tr>' +
1273
+ '</thead>' +
1274
+ '<tbody>' +
1275
+ '<tr>' +
1276
+ '<td>⌘ + ⇧ + L</td>' +
1277
+ '<td>Align Left</td>' +
1278
+ '</tr>' +
1279
+ '<tr>' +
1280
+ '<td>⌘ + ⇧ + E</td>' +
1281
+ '<td>Align Center</td>' +
1282
+ '</tr>' +
1283
+ '<tr>' +
1284
+ '<td>⌘ + ⇧ + R</td>' +
1285
+ '<td>Align Right</td>' +
1286
+ '</tr>' +
1287
+ '<tr>' +
1288
+ '<td>⌘ + ⇧ + J</td>' +
1289
+ '<td>Justify Full</td>' +
1290
+ '</tr>' +
1291
+ '<tr>' +
1292
+ '<td>⌘ + ⇧ + NUM7</td>' +
1293
+ '<td>Ordered List</td>' +
1294
+ '</tr>' +
1295
+ '<tr>' +
1296
+ '<td>⌘ + ⇧ + NUM8</td>' +
1297
+ '<td>Unordered List</td>' +
1298
+ '</tr>' +
1299
+ '</tbody>' +
1300
+ '</table>';
1301
+
1302
+ var sShortcutStyle = '<table class="note-shortcut">' +
1303
+ '<thead>' +
1263
1304
  '<tr>' +
1264
- '<td>Unordered List</td>' +
1265
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">NUM8</button></td>' +
1266
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">NUM8</button></td>' +
1305
+ '<th></th>' +
1306
+ '<th>Document Style</th>' +
1267
1307
  '</tr>' +
1308
+ '</thead>' +
1309
+ '<tbody>' +
1268
1310
  '<tr>' +
1311
+ '<td>⌘ + NUM0</td>' +
1269
1312
  '<td>Normal Text</td>' +
1270
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM0</button></td>' +
1271
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM0</button></td>' +
1272
1313
  '</tr>' +
1273
1314
  '<tr>' +
1315
+ '<td>⌘ + NUM1</td>' +
1274
1316
  '<td>Heading 1</td>' +
1275
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM1</button></td>' +
1276
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM1</button></td>' +
1277
1317
  '</tr>' +
1278
1318
  '<tr>' +
1319
+ '<td>⌘ + NUM2</td>' +
1279
1320
  '<td>Heading 2</td>' +
1280
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM2</button></td>' +
1281
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM2</button></td>' +
1282
1321
  '</tr>' +
1283
1322
  '<tr>' +
1323
+ '<td>⌘ + NUM3</td>' +
1284
1324
  '<td>Heading 3</td>' +
1285
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM3</button></td>' +
1286
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM3</button></td>' +
1287
1325
  '</tr>' +
1288
1326
  '<tr>' +
1327
+ '<td>⌘ + NUM4</td>' +
1289
1328
  '<td>Heading 4</td>' +
1290
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM4</button></td>' +
1291
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM4</button></td>' +
1292
1329
  '</tr>' +
1293
1330
  '<tr>' +
1294
- '<td>Insert Link</td>' +
1295
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">K</button></td>' +
1296
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">K</button></td>' +
1331
+ '<td>⌘ + NUM5</td>' +
1332
+ '<td>Heading 5</td>' +
1297
1333
  '</tr>' +
1298
1334
  '<tr>' +
1299
- '<td>Insert Horizontal Rule</td>' +
1300
- '<td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">ENTER</button></td>' +
1301
- '<td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">ENTER</button></td>' +
1335
+ '<td>⌘ + NUM6</td>' +
1336
+ '<td>Heading 6</td>' +
1337
+ '</tr>' +
1338
+
1339
+ '</tbody>' +
1340
+ '</table>';
1341
+ var sShortcutTable = '<table class="note-shortcut-layout">' +
1342
+ '<tbody>' +
1343
+ '<tr>' +
1344
+ '<td>' + sShortcutAction +'</td>' +
1345
+ '<td>' + sShortcutText +'</td>' +
1346
+ '</tr>' +
1347
+ '<tr>' +
1348
+ '<td>' + sShortcutStyle +'</td>' +
1349
+ '<td>' + sShortcutPara +'</td>' +
1302
1350
  '</tr>' +
1303
1351
  '</tbody>' +
1304
- '</table>';
1352
+ '</table>';
1305
1353
 
1306
1354
  var sDialog = '<div class="note-dialog">' +
1307
1355
  '<div class="note-image-dialog modal hide in" aria-hidden="false">' +
@@ -1335,29 +1383,12 @@
1335
1383
  '</div>' +
1336
1384
  '</div>' +
1337
1385
  '<div class="note-help-dialog modal hide in" aria-hidden="false">' +
1338
- '<div class="modal-header">' +
1339
- '<button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button>' +
1340
- '<h4>Help</h4>' +
1341
- '</div>' +
1342
1386
  '<div class="modal-body">' +
1343
- '<div class="tabbable">' +
1344
- '<ul class="nav nav-tabs">' +
1345
- '<li class="active"><a href="#summernote-shortcut" data-toggle="tab"><i class="icon-keyboard"></i> Shortcut</a></li>' +
1346
- '<li><a href="#summernote-about" data-toggle="tab"><i class="icon-question"></i> About</a></li>' +
1347
- '</ul>' +
1348
- '<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">' +
1349
- '<div class="tab-pane active" id="summernote-shortcut">' +
1350
- sShortcutTable +
1351
- '</div>' +
1352
- '<div class="tab-pane" id="summernote-about">' +
1353
- '<p class="text-center">Summernote v0.2 distributed under the MIT license.</p>' +
1354
- '<p class="text-center"><a href="//hackerwins.github.io/summernote/" target="_blank">Home</a> · <a href="//github.com/HackerWins/summernote" target="_blank">GitHub Project</a> · <a href="//github.com/HackerWins/summernote/issues" target="_blank">Issues</a></p>' +
1355
- '</div>' +
1356
- '</div>' +
1357
- '</div>' +
1358
- '</div>' +
1359
- '<div class="modal-footer">' +
1360
- '<button class="btn" data-dismiss="modal" aria-hidden="true">Ok</button>' +
1387
+ '<div class="modal-background">' +
1388
+ '<a class="modal-close pull-right" data-dismiss="modal" aria-hidden="true" tabindex="-1">Close</a>' +
1389
+ '<div class="title">Keyboard shortcuts</div>' +
1390
+ sShortcutTable +
1391
+ '<p class="text-center"><a href="//hackerwins.github.io/summernote/" target="_blank">Summernote v0.2</a> · <a href="//github.com/HackerWins/summernote" target="_blank">Project</a> · <a href="//github.com/HackerWins/summernote/issues" target="_blank">Issues</a></p>' +
1361
1392
  '</div>' +
1362
1393
  '</div>' +
1363
1394
  '</div>';
@@ -1409,7 +1440,7 @@
1409
1440
  };
1410
1441
 
1411
1442
  // createLayout
1412
- var createLayout = this.createLayout = function(welHolder, nHeight, nTabIndex) {
1443
+ var createLayout = this.createLayout = function(welHolder, nHeight, nTabIndex, aToolbarSetting) {
1413
1444
  //already created
1414
1445
  if (welHolder.next().hasClass('note-editor')) { return; }
1415
1446
 
@@ -1425,6 +1456,18 @@
1425
1456
  welEditable.data('NoteHistory', new History());
1426
1457
 
1427
1458
  //03. create Toolbar
1459
+ var sToolbar = '';
1460
+ for (var idx in aToolbarSetting) {
1461
+ var group = aToolbarSetting[idx];
1462
+ sToolbar += '<div class="note-' + group[0] + ' btn-group">';
1463
+ for (var i in group[1]) {
1464
+ sToolbar += aToolbarItem[group[1][i]];
1465
+ }
1466
+ sToolbar += '</div>';
1467
+ };
1468
+
1469
+ sToolbar = '<div class="note-toolbar btn-toolbar">' + sToolbar + '</div>';
1470
+
1428
1471
  var welToolbar = $(sToolbar).prependTo(welEditor);
1429
1472
  createPalette(welToolbar);
1430
1473
  createTooltip(welToolbar, 'bottom');
@@ -1479,19 +1522,37 @@
1479
1522
  $.fn.extend({
1480
1523
  // create Editor Layout and attach Key and Mouse Event
1481
1524
  summernote: function(options) {
1482
- options = options || {};
1525
+ options = $.extend({
1526
+ toolbar: [
1527
+ ['insert', ['picture', 'link']],
1528
+ ['table', ['table']],
1529
+ ['style', ['style']],
1530
+ ['fontsize', ['fontsize']],
1531
+ ['color', ['color']],
1532
+ ['style', ['bold', 'italic', 'underline', 'clear']],
1533
+ ['para', ['ul', 'ol', 'paragraph']],
1534
+ ['height', ['height']],
1535
+ ['help', ['help']]
1536
+ ]
1537
+ }, options );
1483
1538
 
1484
1539
  this.each(function(idx, elHolder) {
1485
1540
  var welHolder = $(elHolder);
1486
1541
 
1487
1542
  // createLayout with options
1488
- renderer.createLayout(welHolder, options.height, options.tabIndex);
1543
+ renderer.createLayout(welHolder, options.height, options.tabIndex, options.toolbar);
1489
1544
 
1490
1545
  var info = renderer.layoutInfoFromHolder(welHolder);
1491
- eventHandler.attach(info);
1492
-
1493
- if (options.focus) { info.editable.focus(); } // options focus
1546
+ eventHandler.attach(info, options);
1494
1547
  });
1548
+
1549
+ if (this.first() && options.focus) { // focus on first editable element
1550
+ var info = renderer.layoutInfoFromHolder(this.first());
1551
+ info.editable.focus();
1552
+ }
1553
+ if (this.length > 0 && options.oninit) { // callback on init
1554
+ options.oninit();
1555
+ };
1495
1556
  },
1496
1557
  // get the HTML contents of note or set the HTML contents of note.
1497
1558
  code: function(sHTML) {
@@ -1523,7 +1584,7 @@
1523
1584
  },
1524
1585
  // inner object for test
1525
1586
  summernoteInner: function() {
1526
- return { dom: dom, list: list, func: func };
1587
+ return { dom: dom, list: list, func: func, Range: Range };
1527
1588
  }
1528
1589
  });
1529
1590
  })(jQuery); // jQuery
@@ -1,2 +1 @@
1
- !function(a){"use strict";var b=navigator.appVersion.indexOf("Mac")>-1,c=navigator.userAgent.indexOf("MSIE")>-1,d=function(){var a=function(a){return function(b){return a===b}},b=function(a,b){return a===b},c=function(){return!1};return{eq:a,eq2:b,fail:c}}(),e=function(){var a=function(a){return a[0]},b=function(a){return a[a.length-1]},c=function(a){return a.slice(0,a.length-1)},d=function(a){return a.slice(1)},e=function(c,e){if(0===c.length)return[];var f=d(c);return f.reduce(function(a,c){var d=b(a);return e(b(d),c)?d[d.length]=c:a[a.length]=[c],a},[[a(c)]])},f=function(a){for(var b=[],c=0,d=a.length;d>c;c++)a[c]&&b.push(a[c]);return b};return{head:a,last:b,initial:c,tail:d,compact:f,clusterBy:e}}(),f=function(){var b=function(a){return function(b){return b&&b.nodeName===a}},c=function(a){return a&&/^P|^LI|^H[1-7]/.test(a.nodeName)},f=function(a){return a&&/^UL|^OL/.test(a.nodeName)},g=function(b){return b&&a(b).hasClass("note-editable")},h=function(b){return b&&a(b).hasClass("note-control-sizing")},i=function(a,b){for(;a;){if(b(a))return a;a=a.parentNode}return null},j=function(a,b){b=b||d.fail;var c=[];return i(a,function(a){return c.push(a),b(a)}),c},k=function(b,c){for(var d=j(b),e=c;e;e=e.parentNode)if(a.inArray(e,d)>-1)return e;return null},l=function(a,b){for(var c,d=[],e=k(a,b),f=document.createNodeIterator(e,NodeFilter.SHOW_ALL,null,!1),g=!1;(c=f.nextNode())&&(a===c&&(g=!0),g&&d.push(c),b!==c););return d},m=function(a,b){b=b||d.fail;for(var c=[];a&&(c.push(a),a!==b);)a=a.nextSibling;return c},n=function(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a},o=function(b,c){return a.each(c,function(a,c){b.appendChild(c)}),b},p=b("#text"),q=function(a){return p(a)?a.nodeValue.length:a.childNodes.length},r=function(a){for(var b=0;a=a.previousSibling;)b+=1;return b},s=function(b,c){var f=e.initial(j(c,d.eq(b)));return a.map(f,r).reverse()},t=function(a,b){for(var c=a,d=0,e=b.length;e>d;d++)c=c.childNodes[b[d]];return c},u=function(a,b){if(0===b)return a;if(b>=q(a))return a.nextSibling;if(p(a))return a.splitText(b);var c=a.childNodes[b];return a=n(a.cloneNode(!1),a),o(a,m(c))},v=function(a,b,c){var e=j(b,d.eq(a));return 1===e.length?u(b,c):e.reduce(function(a,d){var e=d.cloneNode(!1);return n(e,d),a===b&&(a=u(a,c)),o(e,m(a)),e})};return{isText:p,isPara:c,isList:f,isEditable:g,isControlSizing:h,isAnchor:b("A"),isDiv:b("DIV"),isSpan:b("SPAN"),isB:b("B"),isU:b("U"),isS:b("S"),isI:b("I"),isImg:b("IMG"),ancestor:i,listAncestor:j,listNext:m,commonAncestor:k,listBetween:l,insertAfter:n,position:r,makeOffsetPath:s,fromOffsetPath:t,split:v}}(),g=!!document.createRange,h=function(b,c,h,i){if(0===arguments.length&&document.getSelection){var j=document.getSelection().getRangeAt(0);b=j.startContainer,c=j.startOffset,h=j.endContainer,i=j.endOffset}this.sc=b,this.so=c,this.ec=h,this.eo=i;var k=function(){if(g){var a=document.createRange();return a.setStart(b,c),a.setEnd(h,i),a}};this.select=function(){var a=k();if(g){var b=document.getSelection();b.rangeCount>0&&b.removeAllRanges(),b.addRange(a)}},this.listPara=function(){var c=f.listBetween(b,h),g=e.compact(a.map(c,function(a){return f.ancestor(a,f.isPara)}));return a.map(e.clusterBy(g,d.eq2),e.head)},this.isOnList=function(){var a=f.ancestor(b,f.isList),c=f.ancestor(h,f.isList);return a&&a===c},this.isOnAnchor=function(){var a=f.ancestor(b,f.isAnchor),c=f.ancestor(h,f.isAnchor);return a&&a===c},this.isCollapsed=function(){return b===h&&c===i},this.insertNode=function(a){var b=k();g&&b.insertNode(a)},this.surroundContents=function(b){var c=a("<"+b+" />")[0],d=k();return g&&d.surroundContents(c),c},this.toString=function(){var a=k();return g?a.toString():void 0},this.bookmark=function(a){return{s:{path:f.makeOffsetPath(a,b),offset:c},e:{path:f.makeOffsetPath(a,h),offset:i}}}},i=function(a,b){return new h(f.fromOffsetPath(a,b.s.path),b.s.offset,f.fromOffsetPath(a,b.e.path),b.e.offset)},j=function(){this.styleFont=function(b,c){var d=b.surroundContents("span");a.each(c,function(a,b){d.style[a]=b})},this.stylePara=function(b,c){var d=b.listPara();a.each(d,function(b,d){a.each(c,function(a,b){d.style[a]=b})})},this.current=function(b,c){var d=a(f.isText(b.sc)?b.sc.parentNode:b.sc),e=d.css(["font-size","font-weight","font-style","text-decoration","text-align","list-style-type","line-height"])||{};if(e["font-size"]=parseInt(e["font-size"]),isNaN(parseInt(e["font-weight"]))||(e["font-weight"]=e["font-weight"]>400?"bold":"normal"),b.isOnList()){var g=["circle","disc","disc-leading-zero","square"],h=a.inArray(e["list-style-type"],g)>-1;e["list-style"]=h?"unordered":"ordered"}else e["list-style"]="none";var i=f.ancestor(b.sc,f.isPara);if(i&&i.style["line-height"])e["line-height"]=i.style.lineHeight;else{var j=parseInt(e["line-height"])/parseInt(e["font-size"]);e["line-height"]=j.toFixed(1)}return e.image=f.isImg(c)&&c,e.anchor=b.isOnAnchor()&&f.ancestor(b.sc,f.isAnchor),e.aAncestor=f.listAncestor(b.sc,f.isEditable),e}},k=function(){var a=[],b=[],c=function(a){var b=a[0],c=new h;return{contents:a.html(),bookmark:c.bookmark(b),scrollTop:a.scrollTop()}},d=function(a,b){a.html(b.contents).scrollTop(b.scrollTop),i(a[0],b.bookmark).select()};this.undo=function(e){var f=c(e);0!==a.length&&(d(e,a.pop()),b.push(f))},this.redo=function(e){var f=c(e);0!==b.length&&(d(e,b.pop()),a.push(f))},this.recordUndo=function(d){b=[],a.push(c(d))}},l=function(){var b=new j;this.currentStyle=function(a){return 0==document.getSelection().rangeCount?null:b.current(new h,a)},this.undo=function(a){a.data("NoteHistory").undo(a)},this.redo=function(a){a.data("NoteHistory").redo(a)};for(var d=this.recordUndo=function(a){a.data("NoteHistory").recordUndo(a)},e=["bold","italic","underline","justifyLeft","justifyCenter","justifyRight","justifyFull","insertOrderedList","insertUnorderedList","indent","outdent","formatBlock","removeFormat","backColor","foreColor","insertImage","insertHorizontalRule"],g=0,i=e.length;i>g;g++)this[e[g]]=function(a){return function(b,c){d(b),document.execCommand(a,!1,c)}}(e[g]);this.tab=function(a){var b=new h;return b.isOnList()||!b.isCollapsed()?this.indent(a):void 0},this.fontSize=function(a,b){d(a),document.execCommand("fontSize",!1,3);var c=a.find("font[size=3]");c.removeAttr("size").css("font-size",b+"px")},this.lineHeight=function(a,c){d(a),b.stylePara(new h,{lineHeight:c})},this.unlink=function(a){var b=new h;if(b.isOnAnchor()){d(a);var c=f.ancestor(b.sc,f.isAnchor);b=new h(c,0,c,1),b.select(),document.execCommand("unlink")}},this.setLinkDialog=function(a,b){var c=new h;if(c.isOnAnchor()){var e=f.ancestor(c.sc,f.isAnchor);c=new h(e,0,e,1)}b({range:c,text:c.toString(),url:c.isOnAnchor()?f.ancestor(c.sc,f.isAnchor).href:""},function(b){c.select(),d(a),0!==b.toLowerCase().indexOf("http://")&&(b="http://"+b),document.execCommand("createlink",!1,b)})},this.color=function(a,b){var c=JSON.parse(b);d(a),document.execCommand("foreColor",!1,c.foreColor),document.execCommand("backColor",!1,c.backColor)},this.insertTable=function(b,e){d(b);for(var f,g=e.split("x"),i=g[0],j=g[1],k=[],l=c?"&nbsp;":"<br/>",m=0;i>m;m++)k.push("<td>"+l+"</td>");f=k.join("");for(var n,o=[],p=0;j>p;p++)o.push("<tr>"+f+"</tr>");n=o.join("");var q='<table class="table table-bordered">'+n+"</table>";(new h).insertNode(a(q)[0])},this.float=function(a,b,c){d(a),c.style.cssFloat=b},this.resize=function(a,b,c){d(a),c.style.width=a.width()*b+"px",c.style.height=""},this.resizeTo=function(a,b){b.style.width=a.x+"px",b.style.height=a.y+"px"}},m=function(){this.update=function(b,c){var d=function(b,c){b.find(".dropdown-menu li a").each(function(){var b=a(this).attr("data-value")==c;this.className=b?"checked":""})},e=b.find(".note-fontsize");e.find(".note-current-fontsize").html(c["font-size"]),d(e,parseFloat(c["font-size"]));var f=b.find(".note-line-height");d(f,parseFloat(c["line-height"]));var g=function(a,c){var d=b.find(a);d[c()?"addClass":"removeClass"]("active")};g('button[data-event="bold"]',function(){return"bold"===c["font-weight"]}),g('button[data-event="italic"]',function(){return"italic"===c["font-style"]}),g('button[data-event="underline"]',function(){return"underline"===c["text-decoration"]}),g('button[data-event="justifyLeft"]',function(){return"left"===c["text-align"]||"start"===c["text-align"]}),g('button[data-event="justifyCenter"]',function(){return"center"===c["text-align"]}),g('button[data-event="justifyRight"]',function(){return"right"===c["text-align"]}),g('button[data-event="justifyFull"]',function(){return"justify"===c["text-align"]}),g('button[data-event="insertUnorderedList"]',function(){return"unordered"===c["list-style"]}),g('button[data-event="insertOrderedList"]',function(){return"ordered"===c["list-style"]})},this.updateRecentColor=function(b,c,d){var e=a(b).closest(".note-color"),f=e.find(".note-recent-color"),g=JSON.parse(f.attr("data-value"));g[c]=d,f.attr("data-value",JSON.stringify(g));var h="backColor"===c?"background-color":"color";f.find("i").css(h,d)}},n=function(){this.update=function(b,c){var d=b.find(".note-link-popover"),e=b.find(".note-image-popover");if(c.anchor){var f=d.find("a");f.attr("href",c.anchor.href).html(c.anchor.href);var g=c.anchor.getBoundingClientRect();d.css({display:"block",left:g.left,top:a(document).scrollTop()+g.bottom})}else d.hide();if(c.image){var g=c.image.getBoundingClientRect();e.css({display:"block",left:g.left,top:a(document).scrollTop()+g.bottom})}else e.hide()},this.hide=function(a){a.children().hide()}},o=function(){this.update=function(b,c){var d=b.find(".note-control-selection");if(c.image){var e=c.image.getBoundingClientRect();d.css({display:"block",left:e.left+"px",top:a(document).scrollTop()+e.top+"px",width:e.width+"px",height:e.height+"px"}).data("target",c.image);var f=e.width+"x"+e.height;d.find(".note-control-selection-info").text(f)}else d.hide()},this.hide=function(a){a.children().hide()}},p=function(){this.showImageDialog=function(b,c,d){var e=b.find(".note-image-dialog"),f=b.find(".note-dropzone"),g=b.find(".note-image-input");e.on("shown",function(){f.on("dragenter dragover dragleave",!1),f.on("drop",function(a){c(a),e.modal("hide")}),g.on("change",function(){d(this.files),a(this).val(""),e.modal("hide")})}).on("hidden",function(){f.off("dragenter dragover dragleave drop"),g.off("change")}).modal("show")},this.showLinkDialog=function(a,b,c){var d=a.find(".note-link-dialog"),e=d.find(".note-link-text"),f=d.find(".note-link-url"),g=d.find(".note-link-btn");d.on("shown",function(){e.html(b.text),f.val(b.url).keyup(function(){f.val()?g.removeClass("disabled").attr("disabled",!1):g.addClass("disabled").attr("disabled",!0),b.text||e.html(f.val())}).trigger("focus"),g.click(function(a){d.modal("hide"),c(f.val()),a.preventDefault()})}).on("hidden",function(){f.off("keyup"),d.off("shown hidden"),g.off("click")}).modal("show")},this.showHelpDialog=function(a){a.find(".note-help-dialog").modal("show")}},q=function(){var c=new l,d=new m,e=new n,g=new o,h=new p,i={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,NUM0:48,NUM1:49,NUM4:52,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,U:85,Y:89,Z:90,BACKSLACH:220},j=function(b){var c=a(b).closest(".note-editor");return{editor:function(){return c},editable:function(){return c.find(".note-editable")},toolbar:function(){return c.find(".note-toolbar")},popover:function(){return c.find(".note-popover")},handle:function(){return c.find(".note-handle")},dialog:function(){return c.find(".note-dialog")}}},k=function(a){var d=b?a.metaKey:a.ctrlKey,e=a.shiftKey,f=a.keyCode,g=d||e||f===i.TAB,k=g?j(a.target):null;if(d&&(e&&f===i.Z||f===i.Y))c.redo(k.editable());else if(d&&f===i.Z)c.undo(k.editable());else if(d&&f===i.B)c.bold(k.editable());else if(d&&f===i.I)c.italic(k.editable());else if(d&&f===i.U)c.underline(k.editable());else if(d&&f===i.BACKSLACH)c.removeFormat(k.editable());else if(d&&f===i.K)c.setLinkDialog(k.editable(),function(a,b){h.showLinkDialog(k.dialog(),a,b)});else if(d&&e&&f===i.L)c.justifyLeft(k.editable());else if(d&&e&&f===i.E)c.justifyCenter(k.editable());else if(d&&e&&f===i.R)c.justifyRight(k.editable());else if(d&&e&&f===i.J)c.justifyFull(k.editable());else if(d&&e&&f===i.NUM7)c.insertUnorderedList(k.editable());else if(d&&e&&f===i.NUM8)c.insertOrderedList(k.editable());else if(e&&f===i.TAB)c.outdent(k.editable());else if(f===i.TAB)c.tab(k.editable());else if(d&&f===i.NUM0)c.formatBlock(k.editable(),"P");else if(d&&i.NUM1<=f&&f<=i.NUM4){var l="H"+String.fromCharCode(f);c.formatBlock(k.editable(),l)}else{if(!d||f!==i.ENTER)return(f===i.BACKSPACE||f===i.ENTER||f===i.SPACE)&&c.recordUndo(j(a.target).editable()),void 0;c.insertHorizontalRule(k.editable())}a.preventDefault()},q=function(b,d){a.each(d,function(a,d){var e=new FileReader;e.onload=function(a){c.insertImage(b,a.target.result)},e.readAsDataURL(d)})},r=function(a){var b=a.originalEvent.dataTransfer;if(b&&b.files){var c=j(a.currentTarget||a.target);q(c.editable(),b.files)}a.stopPropagation(),a.preventDefault()},s=function(a){f.isImg(a.target)&&a.preventDefault()},t=function(a){var b=j(a.currentTarget||a.target),f=c.currentStyle(a.target);f&&(d.update(b.toolbar(),f),e.update(b.popover(),f),g.update(b.handle(),f))},u=function(a){var b=j(a.currentTarget||a.target);e.hide(b.popover()),g.hide(b.handle())},v=function(b){if(f.isControlSizing(b.target)){var d,h=j(b.target),i=h.handle(),k=h.popover(),l=h.editable(),m=h.editor(),n=i.find(".note-control-selection").data("target"),o=a(n).offset(),p=a(document).scrollTop();m.on("mousemove",function(a){d={x:a.clientX-o.left,y:a.clientY-(o.top-p)},c.resizeTo(d,n),g.update(i,{image:n}),e.update(k,{image:n})}).on("mouseup",function(){m.off("mousemove").off("mouseup")}),c.recordUndo(l),b.stopPropagation(),b.preventDefault()}},w=function(b){var c=a(b.target).closest("[data-event]");c.length>0&&b.preventDefault()},x=function(b){var e=a(b.target).closest("[data-event]");if(e.length>0){var f,g=e.attr("data-event"),i=e.attr("data-value"),k=j(b.target),l=k.dialog(),m=k.editable();if(-1!==a.inArray(g,["resize","float"])){var n=k.handle(),o=n.find(".note-control-selection");f=o.data("target")}c[g]&&(m.trigger("focus"),c[g](m,i,f)),-1!==a.inArray(g,["backColor","foreColor"])?d.updateRecentColor(e[0],g,i):"showLinkDialog"===g?c.setLinkDialog(m,function(a,b){h.showLinkDialog(l,a,b)}):"showImageDialog"===g?h.showImageDialog(l,r,function(a){q(m,a)}):"showHelpDialog"===g&&h.showHelpDialog(l),t(b)}},y=18,z=function(b){var c,d=a(b.target.parentNode),e=d.next(),f=d.find(".note-dimension-picker-mousecatcher"),g=d.find(".note-dimension-picker-highlighted"),h=d.find(".note-dimension-picker-unhighlighted");if(void 0===b.offsetX){var i=a(b.target).offset();c={x:b.pageX-i.left,y:b.pageY-i.top}}else c={x:b.offsetX,y:b.offsetY};var j={c:Math.ceil(c.x/y)||1,r:Math.ceil(c.y/y)||1};g.css({width:j.c+"em",height:j.r+"em"}),f.attr("data-value",j.c+"x"+j.r),3<j.c&&j.c<20&&h.css({width:j.c+1+"em"}),3<j.r&&j.r<20&&h.css({height:j.r+1+"em"}),e.html(j.c+" x "+j.r)};this.attach=function(a){a.editable.on("keydown",k),a.editable.on("mousedown",s),a.editable.on("keyup mouseup",t),a.editable.on("scroll",u),a.editable.on("dragenter dragover dragleave",!1),a.editable.on("drop",r),a.handle.on("mousedown",v),a.toolbar.on("click",x),a.popover.on("click",x),a.toolbar.on("mousedown",w),a.popover.on("mousedown",w);var b=a.toolbar,c=b.find(".note-dimension-picker-mousecatcher");c.on("mousemove",z)},this.dettach=function(a){a.editable.off(),a.toolbar.off(),a.handle.off(),a.popover.off()}},r=function(){var c='<div class="note-toolbar btn-toolbar"><div class="note-insert btn-group"><button type="button" class="btn btn-small" title="Picture" data-event="showImageDialog" tabindex="-1"><i class="icon-picture"></i></button><button type="button" class="btn btn-small" title="Link" data-event="showLinkDialog" data-shortcut="Ctrl+K" data-mac-shortcut="⌘+K" tabindex="-1"><i class="icon-link"></i></button></div><div class="note-table btn-group"><button type="button" class="btn btn-small dropdown-toggle" title="Table" data-toggle="dropdown" tabindex="-1"><i class="icon-table"></i> <span class="caret"></span></button><ul class="dropdown-menu"><div class="note-dimension-picker"><div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div><div class="note-dimension-picker-highlighted"></div><div class="note-dimension-picker-unhighlighted"></div></div><div class="note-dimension-display"> 1 x 1 </div></ul></div><div class="note-style btn-group"><button type="button" class="btn btn-small dropdown-toggle" title="Style" data-toggle="dropdown" tabindex="-1"><i class="icon-magic"></i> <span class="caret"></span></button><ul class="dropdown-menu"><li><a data-event="formatBlock" data-value="p">Paragraph</a></li><li><a data-event="formatBlock" data-value="blockquote"><blockquote>Quote</blockquote></a></li><li><a data-event="formatBlock" data-value="pre">Code</a></li><li><a data-event="formatBlock" data-value="h1"><h1>Header 1</h1></a></li><li><a data-event="formatBlock" data-value="h2"><h2>Header 2</h2></a></li><li><a data-event="formatBlock" data-value="h3"><h3>Header 3</h3></a></li><li><a data-event="formatBlock" data-value="h4"><h4>Header 4</h4></a></li></ul></div><div class="note-fontsize btn-group"><button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Font Size" tabindex="-1"><span class="note-current-fontsize">11</span> <b class="caret"></b></button><ul class="dropdown-menu"><li><a data-event="fontSize" data-value="8"><i class="icon-ok"></i> 8</a></li><li><a data-event="fontSize" data-value="9"><i class="icon-ok"></i> 9</a></li><li><a data-event="fontSize" data-value="10"><i class="icon-ok"></i> 10</a></li><li><a data-event="fontSize" data-value="11"><i class="icon-ok"></i> 11</a></li><li><a data-event="fontSize" data-value="12"><i class="icon-ok"></i> 12</a></li><li><a data-event="fontSize" data-value="14"><i class="icon-ok"></i> 14</a></li><li><a data-event="fontSize" data-value="18"><i class="icon-ok"></i> 18</a></li><li><a data-event="fontSize" data-value="24"><i class="icon-ok"></i> 24</a></li><li><a data-event="fontSize" data-value="36"><i class="icon-ok"></i> 36</a></li></ul></div><div class="note-color btn-group"><button type="button" class="btn btn-small note-recent-color" title="Recent Color" data-event="color" data-value=\'{"foreColor":"black","backColor":"yellow"}\' tabindex="-1"><i class="icon-font" style="color:black;background-color:yellow;"></i></button><button type="button" class="btn btn-small dropdown-toggle" title="More Color" data-toggle="dropdown" tabindex="-1"><span class="caret"></span></button><ul class="dropdown-menu"><li><div class="btn-group"><div class="note-palette-title">BackColor</div><div class="note-color-palette" data-target-event="backColor"></div></div><div class="btn-group"><div class="note-palette-title">FontColor</div><div class="note-color-palette" data-target-event="foreColor"></div></div></li></ul></div><div class="note-style btn-group"><button type="button" class="btn btn-small" title="Bold" data-shortcut="Ctrl+B" data-mac-shortcut="⌘+B" data-event="bold" tabindex="-1"><i class="icon-bold"></i></button><button type="button" class="btn btn-small" title="Italic" data-shortcut="Ctrl+I" data-mac-shortcut="⌘+I" data-event="italic" tabindex="-1"><i class="icon-italic"></i></button><button type="button" class="btn btn-small" title="Underline" data-shortcut="Ctrl+U" data-mac-shortcut="⌘+U" data-event="underline" tabindex="-1"><i class="icon-underline"></i></button><button type="button" class="btn btn-small" title="Remove Font Style" data-shortcut="Ctrl+\\" data-mac-shortcut="⌘+\\" data-event="removeFormat" tabindex="-1"><i class="icon-eraser"></i></button></div><div class="note-para btn-group"><button type="button" class="btn btn-small" title="Unordered list" data-shortcut="Ctrl+Shift+8" data-mac-shortcut="⌘+⇧+7" data-event="insertUnorderedList" tabindex="-1"><i class="icon-list-ul"></i></button><button type="button" class="btn btn-small" title="Ordered list" data-shortcut="Ctrl+Shift+7" data-mac-shortcut="⌘+⇧+8" data-event="insertOrderedList" tabindex="-1"><i class="icon-list-ol"></i></button><button type="button" class="btn btn-small dropdown-toggle" title="Paragraph" data-toggle="dropdown" tabindex="-1"><i class="icon-align-left"></i> <span class="caret"></span></button><ul class="dropdown-menu right"><li><div class="note-align btn-group"><button type="button" class="btn btn-small" title="Align left" data-shortcut="Ctrl+Shift+L" data-mac-shortcut="⌘+⇧+L" data-event="justifyLeft" tabindex="-1"><i class="icon-align-left"></i></button><button type="button" class="btn btn-small" title="Align center" data-shortcut="Ctrl+Shift+E" data-mac-shortcut="⌘+⇧+E" data-event="justifyCenter" tabindex="-1"><i class="icon-align-center"></i></button><button type="button" class="btn btn-small" title="Align right" data-shortcut="Ctrl+Shift+R" data-mac-shortcut="⌘+⇧+R" data-event="justifyRight" tabindex="-1"><i class="icon-align-right"></i></button><button type="button" class="btn btn-small" title="Justify full" data-shortcut="Ctrl+Shift+J" data-mac-shortcut="⌘+⇧+J" data-event="justifyFull" tabindex="-1"><i class="icon-align-justify"></i></button></div></li><li><div class="note-list btn-group"><button type="button" class="btn btn-small" title="Outdent" data-shortcut="Shift+TAB" data-mac-shortcut="⇧+TAB" data-event="outdent" tabindex="-1"><i class="icon-indent-left"></i></button><button type="button" class="btn btn-small" title="Indent" data-shortcut="TAB" data-mac-shortcut="TAB" data-event="indent" tabindex="-1"><i class="icon-indent-right"></i></button></li></ul></div><div class="note-line-height btn-group"><button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Line Height" tabindex="-1"><i class="icon-text-height"></i>&nbsp; <b class="caret"></b></button><ul class="dropdown-menu right"><li><a data-event="lineHeight" data-value="1.0"><i class="icon-ok"></i> 1.0</a></li><li><a data-event="lineHeight" data-value="1.2"><i class="icon-ok"></i> 1.2</a></li><li><a data-event="lineHeight" data-value="1.4"><i class="icon-ok"></i> 1.4</a></li><li><a data-event="lineHeight" data-value="1.5"><i class="icon-ok"></i> 1.5</a></li><li><a data-event="lineHeight" data-value="1.6"><i class="icon-ok"></i> 1.6</a></li><li><a data-event="lineHeight" data-value="1.8"><i class="icon-ok"></i> 1.8</a></li><li><a data-event="lineHeight" data-value="2.0"><i class="icon-ok"></i> 2.0</a></li><li><a data-event="lineHeight" data-value="3.0"><i class="icon-ok"></i> 3.0</a></li></ul></div><div class="note-help btn-group"><button type="button" class="btn btn-small" title="Help" data-event="showHelpDialog" tabindex="-1"><i class="icon-question"></i></button></div>',d='<div class="note-popover"><div class="note-link-popover popover fade bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content note-link-content"><a href="http://www.google.com" target="_blank">www.google.com</a>&nbsp;&nbsp;<div class="note-insert btn-group"><button type="button" class="btn btn-small" title="Edit" data-event="showLinkDialog" tabindex="-1"><i class="icon-edit"></i></button><button type="button" class="btn btn-small" title="Unlink" data-event="unlink" tabindex="-1"><i class="icon-unlink"></i></button></div></div></div><div class="note-image-popover popover fade bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content note-image-content"><div class="btn-group"><button type="button" class="btn btn-small" title="Resize Full" data-event="resize" data-value="1" tabindex="-1"><i class="icon-resize-full"></i></button><button type="button" class="btn btn-small" title="Resize Half" data-event="resize" data-value="0.5" tabindex="-1">½</button><button type="button" class="btn btn-small" title="Resize Thrid" data-event="resize" data-value="0.33" tabindex="-1">⅓</button><button type="button" class="btn btn-small" title="Resize Quarter" data-event="resize" data-value="0.25" tabindex="-1">¼</button></div><div class="btn-group"><button type="button" class="btn btn-small" title="Float Left" data-event="float" data-value="left" tabindex="-1"><i class="icon-align-left"></i></button><button type="button" class="btn btn-small" title="Float Right" data-event="float" data-value="right" tabindex="-1"><i class="icon-align-right"></i></button><button type="button" class="btn btn-small" title="Float None" data-event="float" data-value="none" tabindex="-1"><i class="icon-reorder"></i></button></div></div></div></div>',e='<div class="note-handle"><div class="note-control-selection"><div class="note-control-selection-bg"></div><div class="note-control-holder note-control-nw"></div><div class="note-control-holder note-control-ne"></div><div class="note-control-holder note-control-sw"></div><div class="note-control-sizing note-control-se"></div><div class="note-control-selection-info"></div></div></div>',f='<table class="table table-hover table-striped table-bordered"><thead><tr><th></th><th>Mac</th><th>Windows</th></tr></thead><tbody><tr><td>Undo</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">Z</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Z</button></td></tr><tr><td>Redo</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">Z</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Y</button></td></tr><tr><td>Indent</td><td><button class="btn btn-mini">Tab</button></td><td><button class="btn btn-mini">Tab</button></td></tr><tr><td>Outdent</td><td><button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">Tab</button></td><td><button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">Tab</button></td></tr><tr><td>Bold</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">B</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">B</button></td></tr><tr><td>Italic</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">I</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">I</button></td></tr><tr><td>Underline</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">U</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">U</button></td></tr><tr><td>Remove Font Style</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">\\</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">\\</button></td></tr><tr><td>Align Left</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">L</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">L</button></td></tr><tr><td>Align Center</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">E</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">E</button></td></tr><tr><td>Align Right</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">R</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">R</button></td></tr><tr><td>Justify Full</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">J</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">J</button></td></tr><tr><td>Ordered List</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">NUM7</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">NUM7</button></td></tr><tr><td>Unordered List</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">⇧</button> + <button class="btn btn-mini">NUM8</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">Shift</button> + <button class="btn btn-mini">NUM8</button></td></tr><tr><td>Normal Text</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM0</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM0</button></td></tr><tr><td>Heading 1</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM1</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM1</button></td></tr><tr><td>Heading 2</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM2</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM2</button></td></tr><tr><td>Heading 3</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM3</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM3</button></td></tr><tr><td>Heading 4</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">NUM4</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">NUM4</button></td></tr><tr><td>Insert Link</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">K</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">K</button></td></tr><tr><td>Insert Horizontal Rule</td><td><button class="btn btn-mini">⌘</button> + <button class="btn btn-mini">ENTER</button></td><td><button class="btn btn-mini">Ctrl</button> + <button class="btn btn-mini">ENTER</button></td></tr></tbody></table>',g='<div class="note-dialog"><div class="note-image-dialog modal hide in" aria-hidden="false"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button><h4>Insert Image</h4></div><div class="modal-body"><div class="row-fluid"><div class="note-dropzone span12">Drag an image here</div><div>or if you prefer...</div><input class="note-image-input" type="file" class="note-link-url" type="text" /></div></div></div><div class="note-link-dialog modal hide in" aria-hidden="false"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button><h4>Edit Link</h4></div><div class="modal-body"><div class="row-fluid"><label>Text to display</label><span class="note-link-text input-xlarge uneditable-input" /><label>To what URL should this link go?</label><input class="note-link-url span12" type="text" /></div></div><div class="modal-footer"><a href="#" class="btn disabled note-link-btn" disabled="disabled">Link</a></div></div><div class="note-help-dialog modal hide in" aria-hidden="false"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button><h4>Help</h4></div><div class="modal-body"><div class="tabbable"><ul class="nav nav-tabs"><li class="active"><a href="#summernote-shortcut" data-toggle="tab"><i class="icon-keyboard"></i> Shortcut</a></li><li><a href="#summernote-about" data-toggle="tab"><i class="icon-question"></i> About</a></li></ul><div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;"><div class="tab-pane active" id="summernote-shortcut">'+f+"</div>"+'<div class="tab-pane" id="summernote-about">'+'<p class="text-center">Summernote v0.2 distributed under the MIT license.</p>'+'<p class="text-center"><a href="//hackerwins.github.io/summernote/" target="_blank">Home</a> · <a href="//github.com/HackerWins/summernote" target="_blank">GitHub Project</a> · <a href="//github.com/HackerWins/summernote/issues" target="_blank">Issues</a></p>'+"</div>"+"</div>"+"</div>"+"</div>"+'<div class="modal-footer">'+'<button class="btn" data-dismiss="modal" aria-hidden="true">Ok</button>'+"</div>"+"</div>"+"</div>",h=function(c,d){c.find("button").each(function(c,d){var e=a(d),f=e.attr(b?"data-mac-shortcut":"data-shortcut");
2
- f&&e.attr("title",function(a,b){return b+" ("+f+")"})}).tooltip({container:"body",placement:d||"top"})},i=[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#EFF7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],j=function(b){b.find(".note-color-palette").each(function(){for(var b=a(this),c=b.attr("data-target-event"),d="",e=0,f=i.length;f>e;e++){for(var g=i[e],h="<div>",j=0,k=g.length;k>j;j++){var l=g[j],m=['<button type="button" class="note-color-btn" style="background-color:',l,';" data-event="',c,'" data-value="',l,'" title="',l,'" data-toggle="button" tabindex="-1"></button>'].join("");h+=m}h+="</div>",d+=h}b.html(d)})};this.createLayout=function(b,f,i){if(!b.next().hasClass("note-editor")){var l=a('<div class="note-editor"></div>'),m=a('<div class="note-editable" contentEditable="true"></div>').prependTo(l);i&&m.attr("tabIndex",i),f&&m.height(f),m.html(b.html()),m.data("NoteHistory",new k);var n=a(c).prependTo(l);j(n),h(n,"bottom");var o=a(d).prependTo(l);h(o),a(e).prependTo(l),a(g).prependTo(l),l.insertAfter(b),b.hide()}};var l=this.layoutInfoFromHolder=function(a){var b=a.next();if(b.hasClass("note-editor"))return{editor:b,editable:b.find(".note-editable"),toolbar:b.find(".note-toolbar"),popover:b.find(".note-popover"),handle:b.find(".note-handle"),dialog:b.find(".note-dialog")}};this.removeLayout=function(a){var b=l(a);b&&(a.html(b.editable.html()),b.editor.remove(),a.show())}},s=new r,t=new q;a.fn.extend({summernote:function(b){b=b||{},this.each(function(c,d){var e=a(d);s.createLayout(e,b.height,b.tabIndex);var f=s.layoutInfoFromHolder(e);t.attach(f),b.focus&&f.editable.focus()})},code:function(b){return void 0===b?this.map(function(b,c){var d=s.layoutInfoFromHolder(a(c)),e=!(!d||!d.editable);return e?d.editable.html():a(c).html()}):(this.each(function(c,d){var e=s.layoutInfoFromHolder(a(d));e&&e.editable&&e.editable.html(b)}),void 0)},destroy:function(){this.each(function(b,c){var d=a(c),e=s.layoutInfoFromHolder(d);e&&e.editable&&(t.dettach(e),s.removeLayout(d))})},summernoteInner:function(){return{dom:f,list:e,func:d}}})}(jQuery);
1
+ !function(a){"use strict";var b=navigator.appVersion.indexOf("Mac")>-1,c=navigator.userAgent.indexOf("MSIE")>-1,d=function(){var a=function(a){return function(b){return a===b}},b=function(a,b){return a===b},c=function(){return!1};return{eq:a,eq2:b,fail:c}}(),e=function(){var a=function(a){return a[0]},b=function(a){return a[a.length-1]},c=function(a){return a.slice(0,a.length-1)},d=function(a){return a.slice(1)},e=function(c,e){if(0===c.length)return[];var f=d(c);return f.reduce(function(a,c){var d=b(a);return e(b(d),c)?d[d.length]=c:a[a.length]=[c],a},[[a(c)]])},f=function(a){for(var b=[],c=0,d=a.length;d>c;c++)a[c]&&b.push(a[c]);return b};return{head:a,last:b,initial:c,tail:d,compact:f,clusterBy:e}}(),f=function(){var b=function(a){return function(b){return b&&b.nodeName===a}},c=function(a){return a&&/^P|^LI|^H[1-7]/.test(a.nodeName)},f=function(a){return a&&/^UL|^OL/.test(a.nodeName)},g=function(b){return b&&a(b).hasClass("note-editable")},h=function(b){return b&&a(b).hasClass("note-control-sizing")},i=function(a,b){for(;a;){if(b(a))return a;a=a.parentNode}return null},j=function(a,b){b=b||d.fail;var c=[];return i(a,function(a){return c.push(a),b(a)}),c},k=function(b,c){for(var d=j(b),e=c;e;e=e.parentNode)if(a.inArray(e,d)>-1)return e;return null},l=function(a,b){for(var c,d=[],e=k(a,b),f=document.createNodeIterator(e,NodeFilter.SHOW_ALL,null,!1),g=!1;(c=f.nextNode())&&(a===c&&(g=!0),g&&d.push(c),b!==c););return d},m=function(a,b){b=b||d.fail;for(var c=[];a&&(c.push(a),a!==b);)a=a.nextSibling;return c},n=function(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a},o=function(b,c){return a.each(c,function(a,c){b.appendChild(c)}),b},p=b("#text"),q=function(a){return p(a)?a.nodeValue.length:a.childNodes.length},r=function(a){for(var b=0;a=a.previousSibling;)b+=1;return b},s=function(b,c){var f=e.initial(j(c,d.eq(b)));return a.map(f,r).reverse()},t=function(a,b){for(var c=a,d=0,e=b.length;e>d;d++)c=c.childNodes[b[d]];return c},u=function(a,b){if(0===b)return a;if(b>=q(a))return a.nextSibling;if(p(a))return a.splitText(b);var c=a.childNodes[b];return a=n(a.cloneNode(!1),a),o(a,m(c))},v=function(a,b,c){var e=j(b,d.eq(a));return 1===e.length?u(b,c):e.reduce(function(a,d){var e=d.cloneNode(!1);return n(e,d),a===b&&(a=u(a,c)),o(e,m(a)),e})};return{isText:p,isPara:c,isList:f,isEditable:g,isControlSizing:h,isAnchor:b("A"),isDiv:b("DIV"),isSpan:b("SPAN"),isB:b("B"),isU:b("U"),isS:b("S"),isI:b("I"),isImg:b("IMG"),ancestor:i,listAncestor:j,listNext:m,commonAncestor:k,listBetween:l,insertAfter:n,position:r,makeOffsetPath:s,fromOffsetPath:t,split:v}}(),g=!!document.createRange,h=function(b,c,h,i){if(0===arguments.length&&document.getSelection){var j=document.getSelection().getRangeAt(0);b=j.startContainer,c=j.startOffset,h=j.endContainer,i=j.endOffset}this.sc=b,this.so=c,this.ec=h,this.eo=i;var k=function(){if(g){var a=document.createRange();return a.setStart(b,c),a.setEnd(h,i),a}};this.select=function(){var a=k();if(g){var b=document.getSelection();b.rangeCount>0&&b.removeAllRanges(),b.addRange(a)}},this.listPara=function(){var c=f.listBetween(b,h),g=e.compact(a.map(c,function(a){return f.ancestor(a,f.isPara)}));return a.map(e.clusterBy(g,d.eq2),e.head)},this.isOnList=function(){var a=f.ancestor(b,f.isList),c=f.ancestor(h,f.isList);return a&&a===c},this.isOnAnchor=function(){var a=f.ancestor(b,f.isAnchor),c=f.ancestor(h,f.isAnchor);return a&&a===c},this.isCollapsed=function(){return b===h&&c===i},this.insertNode=function(a){var b=k();g&&b.insertNode(a)},this.surroundContents=function(b){var c=a("<"+b+" />")[0],d=k();return g&&d.surroundContents(c),c},this.toString=function(){var a=k();return g?a.toString():void 0},this.bookmark=function(a){return{s:{path:f.makeOffsetPath(a,b),offset:c},e:{path:f.makeOffsetPath(a,h),offset:i}}}},i=function(a,b){return new h(f.fromOffsetPath(a,b.s.path),b.s.offset,f.fromOffsetPath(a,b.e.path),b.e.offset)},j=function(){this.styleFont=function(b,c){var d=b.surroundContents("span");a.each(c,function(a,b){d.style[a]=b})},this.stylePara=function(b,c){var d=b.listPara();a.each(d,function(b,d){a.each(c,function(a,b){d.style[a]=b})})},this.current=function(b,c){var d=a(f.isText(b.sc)?b.sc.parentNode:b.sc),e=d.css(["font-size","font-weight","font-style","text-decoration","text-align","list-style-type","line-height"])||{};if(e["font-size"]=parseInt(e["font-size"]),isNaN(parseInt(e["font-weight"]))||(e["font-weight"]=e["font-weight"]>400?"bold":"normal"),b.isOnList()){var g=["circle","disc","disc-leading-zero","square"],h=a.inArray(e["list-style-type"],g)>-1;e["list-style"]=h?"unordered":"ordered"}else e["list-style"]="none";var i=f.ancestor(b.sc,f.isPara);if(i&&i.style["line-height"])e["line-height"]=i.style.lineHeight;else{var j=parseInt(e["line-height"])/parseInt(e["font-size"]);e["line-height"]=j.toFixed(1)}return e.image=f.isImg(c)&&c,e.anchor=b.isOnAnchor()&&f.ancestor(b.sc,f.isAnchor),e.aAncestor=f.listAncestor(b.sc,f.isEditable),e}},k=function(){var a=[],b=[],c=function(a){var b=a[0],c=new h;return{contents:a.html(),bookmark:c.bookmark(b),scrollTop:a.scrollTop()}},d=function(a,b){a.html(b.contents).scrollTop(b.scrollTop),i(a[0],b.bookmark).select()};this.undo=function(e){var f=c(e);0!==a.length&&(d(e,a.pop()),b.push(f))},this.redo=function(e){var f=c(e);0!==b.length&&(d(e,b.pop()),a.push(f))},this.recordUndo=function(d){b=[],a.push(c(d))}},l=function(){var b=new j;this.currentStyle=function(a){return 0==document.getSelection().rangeCount?null:b.current(new h,a)},this.undo=function(a){a.data("NoteHistory").undo(a)},this.redo=function(a){a.data("NoteHistory").redo(a)};for(var d=this.recordUndo=function(a){a.data("NoteHistory").recordUndo(a)},e=["bold","italic","underline","justifyLeft","justifyCenter","justifyRight","justifyFull","insertOrderedList","insertUnorderedList","indent","outdent","formatBlock","removeFormat","backColor","foreColor","insertImage","insertHorizontalRule"],g=0,i=e.length;i>g;g++)this[e[g]]=function(a){return function(b,c){d(b),document.execCommand(a,!1,c)}}(e[g]);this.tab=function(a){var b=new h;return b.isOnList()||!b.isCollapsed()?this.indent(a):void 0},this.fontSize=function(a,b){d(a),document.execCommand("fontSize",!1,3);var c=a.find("font[size=3]");c.removeAttr("size").css("font-size",b+"px")},this.lineHeight=function(a,c){d(a),b.stylePara(new h,{lineHeight:c})},this.unlink=function(a){var b=new h;if(b.isOnAnchor()){d(a);var c=f.ancestor(b.sc,f.isAnchor);b=new h(c,0,c,1),b.select(),document.execCommand("unlink")}},this.setLinkDialog=function(a,b){var c=new h;if(c.isOnAnchor()){var e=f.ancestor(c.sc,f.isAnchor);c=new h(e,0,e,1)}b({range:c,text:c.toString(),url:c.isOnAnchor()?f.ancestor(c.sc,f.isAnchor).href:""},function(b){c.select(),d(a),0!==b.toLowerCase().indexOf("http://")&&(b="http://"+b),document.execCommand("createlink",!1,b)})},this.color=function(a,b){var c=JSON.parse(b);d(a),document.execCommand("foreColor",!1,c.foreColor),document.execCommand("backColor",!1,c.backColor)},this.insertTable=function(b,e){d(b);for(var f,g=e.split("x"),i=g[0],j=g[1],k=[],l=c?"&nbsp;":"<br/>",m=0;i>m;m++)k.push("<td>"+l+"</td>");f=k.join("");for(var n,o=[],p=0;j>p;p++)o.push("<tr>"+f+"</tr>");n=o.join("");var q='<table class="table table-bordered">'+n+"</table>";(new h).insertNode(a(q)[0])},this.float=function(a,b,c){d(a),c.style.cssFloat=b},this.resize=function(a,b,c){d(a),c.style.width=a.width()*b+"px",c.style.height=""},this.resizeTo=function(a,b){b.style.width=a.x+"px",b.style.height=a.y+"px"}},m=function(){this.update=function(b,c){var d=function(b,c){b.find(".dropdown-menu li a").each(function(){var b=a(this).attr("data-value")==c;this.className=b?"checked":""})},e=b.find(".note-fontsize");e.find(".note-current-fontsize").html(c["font-size"]),d(e,parseFloat(c["font-size"]));var f=b.find(".note-height");d(f,parseFloat(c["line-height"]));var g=function(a,c){var d=b.find(a);d[c()?"addClass":"removeClass"]("active")};g('button[data-event="bold"]',function(){return"bold"===c["font-weight"]}),g('button[data-event="italic"]',function(){return"italic"===c["font-style"]}),g('button[data-event="underline"]',function(){return"underline"===c["text-decoration"]}),g('button[data-event="justifyLeft"]',function(){return"left"===c["text-align"]||"start"===c["text-align"]}),g('button[data-event="justifyCenter"]',function(){return"center"===c["text-align"]}),g('button[data-event="justifyRight"]',function(){return"right"===c["text-align"]}),g('button[data-event="justifyFull"]',function(){return"justify"===c["text-align"]}),g('button[data-event="insertUnorderedList"]',function(){return"unordered"===c["list-style"]}),g('button[data-event="insertOrderedList"]',function(){return"ordered"===c["list-style"]})},this.updateRecentColor=function(b,c,d){var e=a(b).closest(".note-color"),f=e.find(".note-recent-color"),g=JSON.parse(f.attr("data-value"));g[c]=d,f.attr("data-value",JSON.stringify(g));var h="backColor"===c?"background-color":"color";f.find("i").css(h,d)}},n=function(){this.update=function(b,c){var d=b.find(".note-link-popover"),e=b.find(".note-image-popover");if(c.anchor){var f=d.find("a");f.attr("href",c.anchor.href).html(c.anchor.href);var g=c.anchor.getBoundingClientRect();d.css({display:"block",left:g.left,top:a(document).scrollTop()+g.bottom})}else d.hide();if(c.image){var g=c.image.getBoundingClientRect();e.css({display:"block",left:g.left,top:a(document).scrollTop()+g.bottom})}else e.hide()},this.hide=function(a){a.children().hide()}},o=function(){this.update=function(b,c){var d=b.find(".note-control-selection");if(c.image){var e=c.image.getBoundingClientRect();d.css({display:"block",left:e.left+"px",top:a(document).scrollTop()+e.top+"px",width:e.width+"px",height:e.height+"px"}).data("target",c.image);var f=e.width+"x"+e.height;d.find(".note-control-selection-info").text(f)}else d.hide()},this.hide=function(a){a.children().hide()}},p=function(){this.showImageDialog=function(b,c,d){var e=b.find(".note-image-dialog"),f=b.find(".note-dropzone"),g=b.find(".note-image-input");e.on("shown",function(){f.on("dragenter dragover dragleave",!1),f.on("drop",function(a){c(a),e.modal("hide")}),g.on("change",function(){d(this.files),a(this).val(""),e.modal("hide")})}).on("hidden",function(){f.off("dragenter dragover dragleave drop"),g.off("change")}).modal("show")},this.showLinkDialog=function(a,b,c){var d=a.find(".note-link-dialog"),e=d.find(".note-link-text"),f=d.find(".note-link-url"),g=d.find(".note-link-btn");d.on("shown",function(){e.html(b.text),f.val(b.url).keyup(function(){f.val()?g.removeClass("disabled").attr("disabled",!1):g.addClass("disabled").attr("disabled",!0),b.text||e.html(f.val())}).trigger("focus"),g.click(function(a){d.modal("hide"),c(f.val()),a.preventDefault()})}).on("hidden",function(){f.off("keyup"),d.off("shown hidden"),g.off("click")}).modal("show")},this.showHelpDialog=function(a){a.find(".note-help-dialog").modal("show")}},q=function(){var c=new l,d=new m,e=new n,g=new o,h=new p,i={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,NUM0:48,NUM1:49,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,U:85,Y:89,Z:90,BACKSLACH:220},j=function(b){var c=a(b).closest(".note-editor");return{editor:function(){return c},editable:function(){return c.find(".note-editable")},toolbar:function(){return c.find(".note-toolbar")},popover:function(){return c.find(".note-popover")},handle:function(){return c.find(".note-handle")},dialog:function(){return c.find(".note-dialog")}}},k=function(a){var d=b?a.metaKey:a.ctrlKey,e=a.shiftKey,f=a.keyCode,g=d||e||f===i.TAB,k=g?j(a.target):null;if(d&&(e&&f===i.Z||f===i.Y))c.redo(k.editable());else if(d&&f===i.Z)c.undo(k.editable());else if(d&&f===i.B)c.bold(k.editable());else if(d&&f===i.I)c.italic(k.editable());else if(d&&f===i.U)c.underline(k.editable());else if(d&&f===i.BACKSLACH)c.removeFormat(k.editable());else if(d&&f===i.K)c.setLinkDialog(k.editable(),function(a,b){h.showLinkDialog(k.dialog(),a,b)});else if(d&&e&&f===i.L)c.justifyLeft(k.editable());else if(d&&e&&f===i.E)c.justifyCenter(k.editable());else if(d&&e&&f===i.R)c.justifyRight(k.editable());else if(d&&e&&f===i.J)c.justifyFull(k.editable());else if(d&&e&&f===i.NUM7)c.insertUnorderedList(k.editable());else if(d&&e&&f===i.NUM8)c.insertOrderedList(k.editable());else if(e&&f===i.TAB)c.outdent(k.editable());else if(f===i.TAB)c.tab(k.editable());else if(d&&f===i.NUM0)c.formatBlock(k.editable(),"P");else if(d&&i.NUM1<=f&&f<=i.NUM6){var l="H"+String.fromCharCode(f);c.formatBlock(k.editable(),l)}else{if(!d||f!==i.ENTER)return(f===i.BACKSPACE||f===i.ENTER||f===i.SPACE)&&c.recordUndo(j(a.target).editable()),void 0;c.insertHorizontalRule(k.editable())}a.preventDefault()},q=function(b,d){a.each(d,function(a,d){var e=new FileReader;e.onload=function(a){c.insertImage(b,a.target.result)},e.readAsDataURL(d)})},r=function(a){var b=a.originalEvent.dataTransfer;if(b&&b.files){var c=j(a.currentTarget||a.target);q(c.editable(),b.files)}a.stopPropagation(),a.preventDefault()},s=function(a){f.isImg(a.target)&&a.preventDefault()},t=function(a){var b=j(a.currentTarget||a.target),f=c.currentStyle(a.target);f&&(d.update(b.toolbar(),f),e.update(b.popover(),f),g.update(b.handle(),f))},u=function(a){var b=j(a.currentTarget||a.target);e.hide(b.popover()),g.hide(b.handle())},v=function(b){if(f.isControlSizing(b.target)){var d,h=j(b.target),i=h.handle(),k=h.popover(),l=h.editable(),m=h.editor(),n=i.find(".note-control-selection").data("target"),o=a(n).offset(),p=a(document).scrollTop();m.on("mousemove",function(a){d={x:a.clientX-o.left,y:a.clientY-(o.top-p)},c.resizeTo(d,n),g.update(i,{image:n}),e.update(k,{image:n})}).on("mouseup",function(){m.off("mousemove").off("mouseup")}),c.recordUndo(l),b.stopPropagation(),b.preventDefault()}},w=function(b){var c=a(b.target).closest("[data-event]");c.length>0&&b.preventDefault()},x=function(b){var e=a(b.target).closest("[data-event]");if(e.length>0){var f,g=e.attr("data-event"),i=e.attr("data-value"),k=j(b.target),l=k.dialog(),m=k.editable();if(-1!==a.inArray(g,["resize","float"])){var n=k.handle(),o=n.find(".note-control-selection");f=o.data("target")}c[g]&&(m.trigger("focus"),c[g](m,i,f)),-1!==a.inArray(g,["backColor","foreColor"])?d.updateRecentColor(e[0],g,i):"showLinkDialog"===g?c.setLinkDialog(m,function(a,b){h.showLinkDialog(l,a,b)}):"showImageDialog"===g?h.showImageDialog(l,r,function(a){q(m,a)}):"showHelpDialog"===g&&h.showHelpDialog(l),t(b)}},y=18,z=function(b){var c,d=a(b.target.parentNode),e=d.next(),f=d.find(".note-dimension-picker-mousecatcher"),g=d.find(".note-dimension-picker-highlighted"),h=d.find(".note-dimension-picker-unhighlighted");if(void 0===b.offsetX){var i=a(b.target).offset();c={x:b.pageX-i.left,y:b.pageY-i.top}}else c={x:b.offsetX,y:b.offsetY};var j={c:Math.ceil(c.x/y)||1,r:Math.ceil(c.y/y)||1};g.css({width:j.c+"em",height:j.r+"em"}),f.attr("data-value",j.c+"x"+j.r),3<j.c&&j.c<20&&h.css({width:j.c+1+"em"}),3<j.r&&j.r<20&&h.css({height:j.r+1+"em"}),e.html(j.c+" x "+j.r)};this.attach=function(a,b){a.editable.on("keydown",k),a.editable.on("mousedown",s),a.editable.on("keyup mouseup",t),a.editable.on("scroll",u),a.editable.on("dragenter dragover dragleave",!1),a.editable.on("drop",r),a.handle.on("mousedown",v),a.toolbar.on("click",x),a.popover.on("click",x),a.toolbar.on("mousedown",w),a.popover.on("mousedown",w);var c=a.toolbar,d=c.find(".note-dimension-picker-mousecatcher");d.on("mousemove",z),b.onenter&&a.editable.keypress(function(a){a.keyCode===i.ENTER&&b.onenter(a)}),b.onfocus&&a.editable.focus(b.onfocus),b.onblur&&a.editable.blur(b.onblur),b.onkeyup&&a.editable.blur(b.onkeyup),b.onkeydown&&a.editable.blur(b.onkeydown)},this.dettach=function(a){a.editable.off(),a.toolbar.off(),a.handle.off(),a.popover.off()}},r=function(){var c={picture:'<button type="button" class="btn btn-small" title="Picture" data-event="showImageDialog" tabindex="-1"><i class="icon-picture"></i></button>',link:'<button type="button" class="btn btn-small" title="Link" data-event="showLinkDialog" data-shortcut="Ctrl+K" data-mac-shortcut="⌘+K" tabindex="-1"><i class="icon-link"></i></button>',table:'<button type="button" class="btn btn-small dropdown-toggle" title="Table" data-toggle="dropdown" tabindex="-1"><i class="icon-table"></i> <span class="caret"></span></button><ul class="dropdown-menu"><div class="note-dimension-picker"><div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div><div class="note-dimension-picker-highlighted"></div><div class="note-dimension-picker-unhighlighted"></div></div><div class="note-dimension-display"> 1 x 1 </div></ul>',style:'<button type="button" class="btn btn-small dropdown-toggle" title="Style" data-toggle="dropdown" tabindex="-1"><i class="icon-magic"></i> <span class="caret"></span></button><ul class="dropdown-menu"><li><a data-event="formatBlock" data-value="p">Normal</a></li><li><a data-event="formatBlock" data-value="blockquote"><blockquote>Quote</blockquote></a></li><li><a data-event="formatBlock" data-value="pre">Code</a></li><li><a data-event="formatBlock" data-value="h1"><h1>Header 1</h1></a></li><li><a data-event="formatBlock" data-value="h2"><h2>Header 2</h2></a></li><li><a data-event="formatBlock" data-value="h3"><h3>Header 3</h3></a></li><li><a data-event="formatBlock" data-value="h4"><h4>Header 4</h4></a></li><li><a data-event="formatBlock" data-value="h5"><h5>Header 5</h5></a></li><li><a data-event="formatBlock" data-value="h6"><h6>Header 6</h6></a></li></ul>',fontsize:'<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Font Size" tabindex="-1"><span class="note-current-fontsize">11</span> <b class="caret"></b></button><ul class="dropdown-menu"><li><a data-event="fontSize" data-value="8"><i class="icon-ok"></i> 8</a></li><li><a data-event="fontSize" data-value="9"><i class="icon-ok"></i> 9</a></li><li><a data-event="fontSize" data-value="10"><i class="icon-ok"></i> 10</a></li><li><a data-event="fontSize" data-value="11"><i class="icon-ok"></i> 11</a></li><li><a data-event="fontSize" data-value="12"><i class="icon-ok"></i> 12</a></li><li><a data-event="fontSize" data-value="14"><i class="icon-ok"></i> 14</a></li><li><a data-event="fontSize" data-value="18"><i class="icon-ok"></i> 18</a></li><li><a data-event="fontSize" data-value="24"><i class="icon-ok"></i> 24</a></li><li><a data-event="fontSize" data-value="36"><i class="icon-ok"></i> 36</a></li></ul>',color:'<button type="button" class="btn btn-small note-recent-color" title="Recent Color" data-event="color" data-value=\'{"foreColor":"black","backColor":"yellow"}\' tabindex="-1"><i class="icon-font" style="color:black;background-color:yellow;"></i></button><button type="button" class="btn btn-small dropdown-toggle" title="More Color" data-toggle="dropdown" tabindex="-1"><span class="caret"></span></button><ul class="dropdown-menu"><li><div class="btn-group"><div class="note-palette-title">BackColor</div><div class="note-color-palette" data-target-event="backColor"></div></div><div class="btn-group"><div class="note-palette-title">FontColor</div><div class="note-color-palette" data-target-event="foreColor"></div></div></li></ul>',bold:'<button type="button" class="btn btn-small" title="Bold" data-shortcut="Ctrl+B" data-mac-shortcut="⌘+B" data-event="bold" tabindex="-1"><i class="icon-bold"></i></button>',italic:'<button type="button" class="btn btn-small" title="Italic" data-shortcut="Ctrl+I" data-mac-shortcut="⌘+I" data-event="italic" tabindex="-1"><i class="icon-italic"></i></button>',underline:'<button type="button" class="btn btn-small" title="Underline" data-shortcut="Ctrl+U" data-mac-shortcut="⌘+U" data-event="underline" tabindex="-1"><i class="icon-underline"></i></button>',clear:'<button type="button" class="btn btn-small" title="Remove Font Style" data-shortcut="Ctrl+\\" data-mac-shortcut="⌘+\\" data-event="removeFormat" tabindex="-1"><i class="icon-eraser"></i></button>',ul:'<button type="button" class="btn btn-small" title="Unordered list" data-shortcut="Ctrl+Shift+8" data-mac-shortcut="⌘+⇧+7" data-event="insertUnorderedList" tabindex="-1"><i class="icon-list-ul"></i></button>',ol:'<button type="button" class="btn btn-small" title="Ordered list" data-shortcut="Ctrl+Shift+7" data-mac-shortcut="⌘+⇧+8" data-event="insertOrderedList" tabindex="-1"><i class="icon-list-ol"></i></button>',paragraph:'<button type="button" class="btn btn-small dropdown-toggle" title="Paragraph" data-toggle="dropdown" tabindex="-1"><i class="icon-align-left"></i> <span class="caret"></span></button><ul class="dropdown-menu right"><li><div class="note-align btn-group"><button type="button" class="btn btn-small" title="Align left" data-shortcut="Ctrl+Shift+L" data-mac-shortcut="⌘+⇧+L" data-event="justifyLeft" tabindex="-1"><i class="icon-align-left"></i></button><button type="button" class="btn btn-small" title="Align center" data-shortcut="Ctrl+Shift+E" data-mac-shortcut="⌘+⇧+E" data-event="justifyCenter" tabindex="-1"><i class="icon-align-center"></i></button><button type="button" class="btn btn-small" title="Align right" data-shortcut="Ctrl+Shift+R" data-mac-shortcut="⌘+⇧+R" data-event="justifyRight" tabindex="-1"><i class="icon-align-right"></i></button><button type="button" class="btn btn-small" title="Justify full" data-shortcut="Ctrl+Shift+J" data-mac-shortcut="⌘+⇧+J" data-event="justifyFull" tabindex="-1"><i class="icon-align-justify"></i></button></div></li><li><div class="note-list btn-group"><button type="button" class="btn btn-small" title="Outdent" data-shortcut="Shift+TAB" data-mac-shortcut="⇧+TAB" data-event="outdent" tabindex="-1"><i class="icon-indent-left"></i></button><button type="button" class="btn btn-small" title="Indent" data-shortcut="TAB" data-mac-shortcut="TAB" data-event="indent" tabindex="-1"><i class="icon-indent-right"></i></button></li></ul>',height:'<button type="button" class="btn btn-small dropdown-toggle" data-toggle="dropdown" title="Line Height" tabindex="-1"><i class="icon-text-height"></i>&nbsp; <b class="caret"></b></button><ul class="dropdown-menu right"><li><a data-event="lineHeight" data-value="1.0"><i class="icon-ok"></i> 1.0</a></li><li><a data-event="lineHeight" data-value="1.2"><i class="icon-ok"></i> 1.2</a></li><li><a data-event="lineHeight" data-value="1.4"><i class="icon-ok"></i> 1.4</a></li><li><a data-event="lineHeight" data-value="1.5"><i class="icon-ok"></i> 1.5</a></li><li><a data-event="lineHeight" data-value="1.6"><i class="icon-ok"></i> 1.6</a></li><li><a data-event="lineHeight" data-value="1.8"><i class="icon-ok"></i> 1.8</a></li><li><a data-event="lineHeight" data-value="2.0"><i class="icon-ok"></i> 2.0</a></li><li><a data-event="lineHeight" data-value="3.0"><i class="icon-ok"></i> 3.0</a></li></ul>',help:'<button type="button" class="btn btn-small" title="Help" data-event="showHelpDialog" tabindex="-1"><i class="icon-question"></i></button>'},d='<div class="note-popover"><div class="note-link-popover popover fade bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content note-link-content"><a href="http://www.google.com" target="_blank">www.google.com</a>&nbsp;&nbsp;<div class="note-insert btn-group"><button type="button" class="btn btn-small" title="Edit" data-event="showLinkDialog" tabindex="-1"><i class="icon-edit"></i></button><button type="button" class="btn btn-small" title="Unlink" data-event="unlink" tabindex="-1"><i class="icon-unlink"></i></button></div></div></div><div class="note-image-popover popover fade bottom in" style="display: none;"><div class="arrow"></div><div class="popover-content note-image-content"><div class="btn-group"><button type="button" class="btn btn-small" title="Resize Full" data-event="resize" data-value="1" tabindex="-1"><i class="icon-resize-full"></i></button><button type="button" class="btn btn-small" title="Resize Half" data-event="resize" data-value="0.5" tabindex="-1">½</button><button type="button" class="btn btn-small" title="Resize Thrid" data-event="resize" data-value="0.33" tabindex="-1">⅓</button><button type="button" class="btn btn-small" title="Resize Quarter" data-event="resize" data-value="0.25" tabindex="-1">¼</button></div><div class="btn-group"><button type="button" class="btn btn-small" title="Float Left" data-event="float" data-value="left" tabindex="-1"><i class="icon-align-left"></i></button><button type="button" class="btn btn-small" title="Float Right" data-event="float" data-value="right" tabindex="-1"><i class="icon-align-right"></i></button><button type="button" class="btn btn-small" title="Float None" data-event="float" data-value="none" tabindex="-1"><i class="icon-reorder"></i></button></div></div></div></div>',e='<div class="note-handle"><div class="note-control-selection"><div class="note-control-selection-bg"></div><div class="note-control-holder note-control-nw"></div><div class="note-control-holder note-control-ne"></div><div class="note-control-holder note-control-sw"></div><div class="note-control-sizing note-control-se"></div><div class="note-control-selection-info"></div></div></div>',f='<table class="note-shortcut"><thead><tr><th></th><th>Text formatting</th></tr></thead><tbody><tr><td>⌘ + B</td><td>Bold</td></tr><tr><td>⌘ + I</td><td>Italic</td></tr><tr><td>⌘ + U</td><td>Underline</td></tr><tr><td>⌘ + \\</td><td>Remove Font Style</td></tr></tr></tbody></table>',g='<table class="note-shortcut"><thead><tr><th></th><th>Action</th></tr></thead><tbody><tr><td>⌘ + Z</td><td>Undo</td></tr><tr><td>⌘ + ⇧ + Z</td><td>Redo</td></tr><tr><td>Tab</td><td>Indent</td></tr><tr><td>⇧ + Tab</td><td>Outdent</td></tr><tr><td>⌘ + K</td><td>Insert Link</td></tr><tr><td>⌘ + ENTER</td><td>Insert Horizontal Rule</td></tr></tbody></table>',h='<table class="note-shortcut"><thead><tr><th></th><th>Paragraph formatting</th></tr></thead><tbody><tr><td>⌘ + ⇧ + L</td><td>Align Left</td></tr><tr><td>⌘ + ⇧ + E</td><td>Align Center</td></tr><tr><td>⌘ + ⇧ + R</td><td>Align Right</td></tr><tr><td>⌘ + ⇧ + J</td><td>Justify Full</td></tr><tr><td>⌘ + ⇧ + NUM7</td><td>Ordered List</td></tr><tr><td>⌘ + ⇧ + NUM8</td><td>Unordered List</td></tr></tbody></table>',i='<table class="note-shortcut"><thead><tr><th></th><th>Document Style</th></tr></thead><tbody><tr><td>⌘ + NUM0</td><td>Normal Text</td></tr><tr><td>⌘ + NUM1</td><td>Heading 1</td></tr><tr><td>⌘ + NUM2</td><td>Heading 2</td></tr><tr><td>⌘ + NUM3</td><td>Heading 3</td></tr><tr><td>⌘ + NUM4</td><td>Heading 4</td></tr><tr><td>⌘ + NUM5</td><td>Heading 5</td></tr><tr><td>⌘ + NUM6</td><td>Heading 6</td></tr></tbody></table>',j='<table class="note-shortcut-layout"><tbody><tr><td>'+g+"</td>"+"<td>"+f+"</td>"+"</tr>"+"<tr>"+"<td>"+i+"</td>"+"<td>"+h+"</td>"+"</tr>"+"</tbody>"+"</table>",l='<div class="note-dialog"><div class="note-image-dialog modal hide in" aria-hidden="false"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button><h4>Insert Image</h4></div><div class="modal-body"><div class="row-fluid"><div class="note-dropzone span12">Drag an image here</div><div>or if you prefer...</div><input class="note-image-input" type="file" class="note-link-url" type="text" /></div></div></div><div class="note-link-dialog modal hide in" aria-hidden="false"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true" tabindex="-1">×</button><h4>Edit Link</h4></div><div class="modal-body"><div class="row-fluid"><label>Text to display</label><span class="note-link-text input-xlarge uneditable-input" /><label>To what URL should this link go?</label><input class="note-link-url span12" type="text" /></div></div><div class="modal-footer"><a href="#" class="btn disabled note-link-btn" disabled="disabled">Link</a></div></div><div class="note-help-dialog modal hide in" aria-hidden="false"><div class="modal-body"><div class="modal-background"><a class="modal-close pull-right" data-dismiss="modal" aria-hidden="true" tabindex="-1">Close</a><div class="title">Keyboard shortcuts</div>'+j+'<p class="text-center"><a href="//hackerwins.github.io/summernote/" target="_blank">Summernote v0.2</a> · <a href="//github.com/HackerWins/summernote" target="_blank">Project</a> · <a href="//github.com/HackerWins/summernote/issues" target="_blank">Issues</a></p>'+"</div>"+"</div>"+"</div>",m=function(c,d){c.find("button").each(function(c,d){var e=a(d),f=e.attr(b?"data-mac-shortcut":"data-shortcut");f&&e.attr("title",function(a,b){return b+" ("+f+")"})}).tooltip({container:"body",placement:d||"top"})},n=[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#EFF7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],o=function(b){b.find(".note-color-palette").each(function(){for(var b=a(this),c=b.attr("data-target-event"),d="",e=0,f=n.length;f>e;e++){for(var g=n[e],h="<div>",i=0,j=g.length;j>i;i++){var k=g[i],l=['<button type="button" class="note-color-btn" style="background-color:',k,';" data-event="',c,'" data-value="',k,'" title="',k,'" data-toggle="button" tabindex="-1"></button>'].join("");h+=l}h+="</div>",d+=h}b.html(d)})};this.createLayout=function(b,f,g,h){if(!b.next().hasClass("note-editor")){var i=a('<div class="note-editor"></div>'),j=a('<div class="note-editable" contentEditable="true"></div>').prependTo(i);g&&j.attr("tabIndex",g),f&&j.height(f),j.html(b.html()),j.data("NoteHistory",new k);var n="";for(var p in h){var q=h[p];n+='<div class="note-'+q[0]+' btn-group">';for(var r in q[1])n+=c[q[1][r]];n+="</div>"}n='<div class="note-toolbar btn-toolbar">'+n+"</div>";var s=a(n).prependTo(i);o(s),m(s,"bottom");var t=a(d).prependTo(i);m(t),a(e).prependTo(i),a(l).prependTo(i),i.insertAfter(b),b.hide()}};var p=this.layoutInfoFromHolder=function(a){var b=a.next();if(b.hasClass("note-editor"))return{editor:b,editable:b.find(".note-editable"),toolbar:b.find(".note-toolbar"),popover:b.find(".note-popover"),handle:b.find(".note-handle"),dialog:b.find(".note-dialog")}};this.removeLayout=function(a){var b=p(a);b&&(a.html(b.editable.html()),b.editor.remove(),a.show())}},s=new r,t=new q;a.fn.extend({summernote:function(b){if(b=a.extend({toolbar:[["insert",["picture","link"]],["table",["table"]],["style",["style"]],["fontsize",["fontsize"]],["color",["color"]],["style",["bold","italic","underline","clear"]],["para",["ul","ol","paragraph"]],["height",["height"]],["help",["help"]]]},b),this.each(function(c,d){var e=a(d);s.createLayout(e,b.height,b.tabIndex,b.toolbar);var f=s.layoutInfoFromHolder(e);t.attach(f,b)}),this.first()&&b.focus){var c=s.layoutInfoFromHolder(this.first());c.editable.focus()}this.length>0&&b.oninit&&b.oninit()},code:function(b){return void 0===b?this.map(function(b,c){var d=s.layoutInfoFromHolder(a(c)),e=!(!d||!d.editable);return e?d.editable.html():a(c).html()}):(this.each(function(c,d){var e=s.layoutInfoFromHolder(a(d));e&&e.editable&&e.editable.html(b)}),void 0)},destroy:function(){this.each(function(b,c){var d=a(c),e=s.layoutInfoFromHolder(d);e&&e.editable&&(t.dettach(e),s.removeLayout(d))})},summernoteInner:function(){return{dom:f,list:e,func:d}}})}(jQuery);
@@ -5265,4 +5265,4 @@
5265
5265
  }
5266
5266
  .note-editor .affix {
5267
5267
  position: fixed;
5268
- }
5268
+ }
@@ -1 +1 @@
1
- .note-editor{border:1px solid #a9a9a9}.note-editor .note-toolbar{padding:5px;margin:0;background-color:#f5f5f5;border-bottom:1px solid #a9a9a9}.note-editor .note-toolbar .note-table .dropdown-menu{min-width:0;padding:5px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker{font-size:18px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:20em;height:20em;cursor:pointer}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-editor .note-toolbar .note-style h1,.note-editor .note-toolbar .note-style h2,.note-editor .note-toolbar .note-style h3,.note-editor .note-toolbar .note-style h4,.note-editor .note-toolbar .note-style blockquote{margin:0}.note-editor .note-toolbar .note-fontsize button{height:26px}.note-editor .note-toolbar .note-color .dropdown-toggle{width:20px;padding:2px 5px}.note-editor .note-toolbar .note-color .dropdown-menu{padding:5px}.note-editor .note-toolbar .note-color .dropdown-menu .note-palette-title{font-size:12px}.note-editor .note-toolbar .note-para .dropdown-menu{min-width:140px;padding:5px}.note-editor .note-toolbar .note-para li:first-child{margin-bottom:5px}.note-editor .note-popover .popover{max-width:none}.note-editor .note-popover .popover .popover-content{padding:5px}.note-editor .note-popover .popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-editor .note-popover .popover .arrow{left:20px}.note-editor .note-handle .note-control-selection{position:absolute;display:none;border:1px solid black}.note-editor .note-handle .note-control-selection>div{position:absolute}.note-editor .note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:black;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-editor .note-handle .note-control-selection .note-control-handle{width:7px;height:7px;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:white;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-editor .note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:none}.note-editor .note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-editor .note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-editor .note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;color:white;background-color:black;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-editor .note-dialog .note-image-dialog .note-dropzone{min-height:200px;font-size:30px;line-height:6;color:lightgray;text-align:center;border:4px dashed lightgray}.note-editor .note-editable{padding:10px;overflow:scroll;outline:0}.note-editor .dropdown-menu{min-width:90px}.note-editor .dropdown-menu.right{right:0;left:auto}.note-editor .dropdown-menu.right::before{right:9px;left:auto!important}.note-editor .dropdown-menu.right::after{right:10px;left:auto!important}.note-editor .dropdown-menu li a i{color:deepskyblue;visibility:hidden}.note-editor .dropdown-menu li a.checked i{visibility:visible}.note-editor .btn-small{min-height:26px;font-size:14px}.note-editor .note-color-palette{line-height:1}.note-editor .note-color-palette div .note-color-btn{width:17px;height:17px;padding:0;margin:0;border:1px solid #fff}.note-editor .note-color-palette div .note-color-btn:hover{border:1px solid #000}
1
+ .note-editor{border:1px solid #a9a9a9}.note-editor .note-toolbar{padding:5px;margin:0;background-color:#f5f5f5;border-bottom:1px solid #a9a9a9}.note-editor .note-toolbar .note-table .dropdown-menu{min-width:0;padding:5px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker{font-size:18px}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:20em;height:20em;cursor:pointer}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-editor .note-toolbar .note-table .dropdown-menu .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-editor .note-toolbar .note-style h1,.note-editor .note-toolbar .note-style h2,.note-editor .note-toolbar .note-style h3,.note-editor .note-toolbar .note-style h4,.note-editor .note-toolbar .note-style h5,.note-editor .note-toolbar .note-style h6,.note-editor .note-toolbar .note-style blockquote{margin:0}.note-editor .note-toolbar .note-fontsize button{height:26px}.note-editor .note-toolbar .note-color .dropdown-toggle{width:20px;padding:2px 5px}.note-editor .note-toolbar .note-color .dropdown-menu{padding:5px}.note-editor .note-toolbar .note-color .dropdown-menu .note-palette-title{font-size:12px}.note-editor .note-toolbar .note-para .dropdown-menu{min-width:140px;padding:5px}.note-editor .note-toolbar .note-para li:first-child{margin-bottom:5px}.note-editor .note-popover .popover{max-width:none}.note-editor .note-popover .popover .popover-content{padding:5px}.note-editor .note-popover .popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-editor .note-popover .popover .arrow{left:20px}.note-editor .note-handle .note-control-selection{position:absolute;display:none;border:1px solid black}.note-editor .note-handle .note-control-selection>div{position:absolute}.note-editor .note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:black;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-editor .note-handle .note-control-selection .note-control-handle{width:7px;height:7px;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:white;border:1px solid black}.note-editor .note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-editor .note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:none}.note-editor .note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-editor .note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-editor .note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;color:white;background-color:black;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-editor .note-dialog .note-image-dialog .note-dropzone{min-height:200px;font-size:30px;line-height:6;color:lightgray;text-align:center;border:4px dashed lightgray}.note-editor .note-dialog .note-help-dialog{font-size:12px;color:white;background:transparent;border:1px solid white}.note-editor .note-dialog .note-help-dialog a{font-size:12px;color:white}.note-editor .note-dialog .note-help-dialog .title{padding-bottom:5px;font-size:14px;font-weight:bold;color:white;border-bottom:white 1px solid}.note-editor .note-dialog .note-help-dialog .modal-close{font-size:14px;color:#dd0;cursor:pointer}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout{width:100%}.note-editor .note-dialog .note-help-dialog .note-shortcut-layout td{vertical-align:top}.note-editor .note-dialog .note-help-dialog .note-shortcut{margin-top:8px}.note-editor .note-dialog .note-help-dialog .note-shortcut th{font-size:13px;color:#dd0;text-align:left}.note-editor .note-dialog .note-help-dialog .note-shortcut td:first-child{min-width:110px;padding-right:10px;font-family:"Courier New";color:#dd0;text-align:right}.note-editor .note-editable{padding:10px;overflow:scroll;outline:0}.note-editor .dropdown-menu{min-width:90px}.note-editor .dropdown-menu.right{right:0;left:auto}.note-editor .dropdown-menu.right::before{right:9px;left:auto!important}.note-editor .dropdown-menu.right::after{right:10px;left:auto!important}.note-editor .dropdown-menu li a i{color:deepskyblue;visibility:hidden}.note-editor .dropdown-menu li a.checked i{visibility:visible}.note-editor .btn-small{min-height:26px;font-size:14px}.note-editor .note-color-palette{line-height:1}.note-editor .note-color-palette div .note-color-btn{width:17px;height:17px;padding:0;margin:0;border:1px solid #fff}.note-editor .note-color-palette div .note-color-btn:hover{border:1px solid #000}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: summernote-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.3
4
+ version: 0.2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hyo Seong Choi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-15 00:00:00.000000000 Z
11
+ date: 2013-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties