| @@ 7220-7307 (lines=88) @@ | ||
| 7217 | }; |
|
| 7218 | }; |
|
| 7219 | ||
| 7220 | var register = function (editor) { |
|
| 7221 | var alignFormats = [ |
|
| 7222 | 'alignleft', |
|
| 7223 | 'aligncenter', |
|
| 7224 | 'alignright', |
|
| 7225 | 'alignjustify' |
|
| 7226 | ]; |
|
| 7227 | var defaultAlign = 'alignleft'; |
|
| 7228 | var alignMenuItems = [ |
|
| 7229 | { |
|
| 7230 | text: 'Left', |
|
| 7231 | icon: 'alignleft', |
|
| 7232 | onclick: toggleFormat(editor, 'alignleft') |
|
| 7233 | }, |
|
| 7234 | { |
|
| 7235 | text: 'Center', |
|
| 7236 | icon: 'aligncenter', |
|
| 7237 | onclick: toggleFormat(editor, 'aligncenter') |
|
| 7238 | }, |
|
| 7239 | { |
|
| 7240 | text: 'Right', |
|
| 7241 | icon: 'alignright', |
|
| 7242 | onclick: toggleFormat(editor, 'alignright') |
|
| 7243 | }, |
|
| 7244 | { |
|
| 7245 | text: 'Justify', |
|
| 7246 | icon: 'alignjustify', |
|
| 7247 | onclick: toggleFormat(editor, 'alignjustify') |
|
| 7248 | } |
|
| 7249 | ]; |
|
| 7250 | editor.addMenuItem('align', { |
|
| 7251 | text: 'Align', |
|
| 7252 | menu: alignMenuItems |
|
| 7253 | }); |
|
| 7254 | editor.addButton('align', { |
|
| 7255 | type: 'menubutton', |
|
| 7256 | icon: defaultAlign, |
|
| 7257 | menu: alignMenuItems, |
|
| 7258 | onShowMenu: function (e) { |
|
| 7259 | var menu = e.control.menu; |
|
| 7260 | global$4.each(alignFormats, function (formatName, idx) { |
|
| 7261 | menu.items().eq(idx).each(function (item) { |
|
| 7262 | return item.active(editor.formatter.match(formatName)); |
|
| 7263 | }); |
|
| 7264 | }); |
|
| 7265 | }, |
|
| 7266 | onPostRender: function (e) { |
|
| 7267 | var ctrl = e.control; |
|
| 7268 | global$4.each(alignFormats, function (formatName, idx) { |
|
| 7269 | addFormatChangedListener(editor, formatName, function (state) { |
|
| 7270 | ctrl.icon(defaultAlign); |
|
| 7271 | if (state) { |
|
| 7272 | ctrl.icon(formatName); |
|
| 7273 | } |
|
| 7274 | }); |
|
| 7275 | }); |
|
| 7276 | } |
|
| 7277 | }); |
|
| 7278 | global$4.each({ |
|
| 7279 | alignleft: [ |
|
| 7280 | 'Align left', |
|
| 7281 | 'JustifyLeft' |
|
| 7282 | ], |
|
| 7283 | aligncenter: [ |
|
| 7284 | 'Align center', |
|
| 7285 | 'JustifyCenter' |
|
| 7286 | ], |
|
| 7287 | alignright: [ |
|
| 7288 | 'Align right', |
|
| 7289 | 'JustifyRight' |
|
| 7290 | ], |
|
| 7291 | alignjustify: [ |
|
| 7292 | 'Justify', |
|
| 7293 | 'JustifyFull' |
|
| 7294 | ], |
|
| 7295 | alignnone: [ |
|
| 7296 | 'No alignment', |
|
| 7297 | 'JustifyNone' |
|
| 7298 | ] |
|
| 7299 | }, function (item, name) { |
|
| 7300 | editor.addButton(name, { |
|
| 7301 | active: false, |
|
| 7302 | tooltip: item[0], |
|
| 7303 | cmd: item[1], |
|
| 7304 | onPostRender: postRenderFormatToggle(editor, name) |
|
| 7305 | }); |
|
| 7306 | }); |
|
| 7307 | }; |
|
| 7308 | var Align = { register: register }; |
|
| 7309 | ||
| 7310 | var getFirstFont = function (fontFamily) { |
|
| @@ 7062-7149 (lines=88) @@ | ||
| 7059 | }; |
|
| 7060 | }; |
|
| 7061 | ||
| 7062 | var register = function (editor) { |
|
| 7063 | var alignFormats = [ |
|
| 7064 | 'alignleft', |
|
| 7065 | 'aligncenter', |
|
| 7066 | 'alignright', |
|
| 7067 | 'alignjustify' |
|
| 7068 | ]; |
|
| 7069 | var defaultAlign = 'alignleft'; |
|
| 7070 | var alignMenuItems = [ |
|
| 7071 | { |
|
| 7072 | text: 'Left', |
|
| 7073 | icon: 'alignleft', |
|
| 7074 | onclick: toggleFormat(editor, 'alignleft') |
|
| 7075 | }, |
|
| 7076 | { |
|
| 7077 | text: 'Center', |
|
| 7078 | icon: 'aligncenter', |
|
| 7079 | onclick: toggleFormat(editor, 'aligncenter') |
|
| 7080 | }, |
|
| 7081 | { |
|
| 7082 | text: 'Right', |
|
| 7083 | icon: 'alignright', |
|
| 7084 | onclick: toggleFormat(editor, 'alignright') |
|
| 7085 | }, |
|
| 7086 | { |
|
| 7087 | text: 'Justify', |
|
| 7088 | icon: 'alignjustify', |
|
| 7089 | onclick: toggleFormat(editor, 'alignjustify') |
|
| 7090 | } |
|
| 7091 | ]; |
|
| 7092 | editor.addMenuItem('align', { |
|
| 7093 | text: 'Align', |
|
| 7094 | menu: alignMenuItems |
|
| 7095 | }); |
|
| 7096 | editor.addButton('align', { |
|
| 7097 | type: 'menubutton', |
|
| 7098 | icon: defaultAlign, |
|
| 7099 | menu: alignMenuItems, |
|
| 7100 | onShowMenu: function (e) { |
|
| 7101 | var menu = e.control.menu; |
|
| 7102 | global$2.each(alignFormats, function (formatName, idx) { |
|
| 7103 | menu.items().eq(idx).each(function (item) { |
|
| 7104 | return item.active(editor.formatter.match(formatName)); |
|
| 7105 | }); |
|
| 7106 | }); |
|
| 7107 | }, |
|
| 7108 | onPostRender: function (e) { |
|
| 7109 | var ctrl = e.control; |
|
| 7110 | global$2.each(alignFormats, function (formatName, idx) { |
|
| 7111 | addFormatChangedListener(editor, formatName, function (state) { |
|
| 7112 | ctrl.icon(defaultAlign); |
|
| 7113 | if (state) { |
|
| 7114 | ctrl.icon(formatName); |
|
| 7115 | } |
|
| 7116 | }); |
|
| 7117 | }); |
|
| 7118 | } |
|
| 7119 | }); |
|
| 7120 | global$2.each({ |
|
| 7121 | alignleft: [ |
|
| 7122 | 'Align left', |
|
| 7123 | 'JustifyLeft' |
|
| 7124 | ], |
|
| 7125 | aligncenter: [ |
|
| 7126 | 'Align center', |
|
| 7127 | 'JustifyCenter' |
|
| 7128 | ], |
|
| 7129 | alignright: [ |
|
| 7130 | 'Align right', |
|
| 7131 | 'JustifyRight' |
|
| 7132 | ], |
|
| 7133 | alignjustify: [ |
|
| 7134 | 'Justify', |
|
| 7135 | 'JustifyFull' |
|
| 7136 | ], |
|
| 7137 | alignnone: [ |
|
| 7138 | 'No alignment', |
|
| 7139 | 'JustifyNone' |
|
| 7140 | ] |
|
| 7141 | }, function (item, name) { |
|
| 7142 | editor.addButton(name, { |
|
| 7143 | active: false, |
|
| 7144 | tooltip: item[0], |
|
| 7145 | cmd: item[1], |
|
| 7146 | onPostRender: postRenderFormatToggle(editor, name) |
|
| 7147 | }); |
|
| 7148 | }); |
|
| 7149 | }; |
|
| 7150 | var Align = { register: register }; |
|
| 7151 | ||
| 7152 | var getFirstFont = function (fontFamily) { |
|