PageRenderTime 25ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/src/js/settings.js

https://github.com/JohnRandom/summernote
JavaScript | 281 lines | 233 code | 20 blank | 28 comment | 0 complexity | 896813545e520b222e615c40983886f4 MD5 | raw file
  1. define('summernote/settings', function () {
  2. var settings = {
  3. // version
  4. version: '@VERSION',
  5. /**
  6. * options
  7. */
  8. options: {
  9. width: null, // set editor width
  10. height: null, // set editor height, ex) 300
  11. minHeight: null, // set minimum height of editor
  12. maxHeight: null, // set maximum height of editor
  13. focus: false, // set focus to editable area after initializing summernote
  14. tabsize: 4, // size of tab ex) 2 or 4
  15. styleWithSpan: true, // style with span (Chrome and FF only)
  16. disableLinkTarget: false, // hide link Target Checkbox
  17. disableDragAndDrop: false, // disable drag and drop event
  18. disableResizeEditor: false, // disable resizing editor
  19. codemirror: { // codemirror options
  20. mode: 'text/html',
  21. htmlMode: true,
  22. lineNumbers: true
  23. },
  24. // language
  25. lang: 'en-US', // language 'en-US', 'ko-KR', ...
  26. direction: null, // text direction, ex) 'rtl'
  27. // toolbar
  28. toolbar: [
  29. ['style', ['style']],
  30. ['font', ['bold', 'italic', 'underline', 'superscript', 'subscript', 'strikethrough', 'clear']],
  31. ['fontname', ['fontname']],
  32. // ['fontsize', ['fontsize']], // Still buggy
  33. ['color', ['color']],
  34. ['para', ['ul', 'ol', 'paragraph']],
  35. ['height', ['height']],
  36. ['table', ['table']],
  37. ['insert', ['link', 'picture', 'video', 'hr']],
  38. ['view', ['fullscreen', 'codeview']],
  39. ['help', ['help']]
  40. ],
  41. // air mode: inline editor
  42. airMode: false,
  43. // airPopover: [
  44. // ['style', ['style']],
  45. // ['font', ['bold', 'italic', 'underline', 'clear']],
  46. // ['fontname', ['fontname']],
  47. // ['fontsize', ['fontsize']], // Still buggy
  48. // ['color', ['color']],
  49. // ['para', ['ul', 'ol', 'paragraph']],
  50. // ['height', ['height']],
  51. // ['table', ['table']],
  52. // ['insert', ['link', 'picture', 'video']],
  53. // ['help', ['help']]
  54. // ],
  55. airPopover: [
  56. ['color', ['color']],
  57. ['font', ['bold', 'underline', 'clear']],
  58. ['para', ['ul', 'paragraph']],
  59. ['table', ['table']],
  60. ['insert', ['link', 'picture']]
  61. ],
  62. // style tag
  63. styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
  64. // default fontName
  65. defaultFontName: 'Arial',
  66. // fontName
  67. fontNames: [
  68. 'Serif', 'Sans', 'Arial', 'Arial Black', 'Courier',
  69. 'Courier New', 'Comic Sans MS', 'Helvetica', 'Impact', 'Lucida Grande',
  70. 'Lucida Sans', 'Tahoma', 'Times', 'Times New Roman', 'Verdana'
  71. ],
  72. // pallete colors(n x n)
  73. colors: [
  74. ['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'],
  75. ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'],
  76. ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'],
  77. ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'],
  78. ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'],
  79. ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'],
  80. ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'],
  81. ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031']
  82. ],
  83. // fontSize
  84. fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'],
  85. // lineHeight
  86. lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],
  87. // callbacks
  88. oninit: null, // initialize
  89. onfocus: null, // editable has focus
  90. onblur: null, // editable out of focus
  91. onenter: null, // enter key pressed
  92. onkeyup: null, // keyup
  93. onkeydown: null, // keydown
  94. onImageUpload: null, // imageUploadHandler
  95. onImageUploadError: null, // imageUploadErrorHandler
  96. onToolbarClick: null,
  97. keyMap: {
  98. pc: {
  99. 'CTRL+Z': 'undo',
  100. 'CTRL+Y': 'redo',
  101. 'TAB': 'tab',
  102. 'SHIFT+TAB': 'untab',
  103. 'CTRL+B': 'bold',
  104. 'CTRL+I': 'italic',
  105. 'CTRL+U': 'underline',
  106. 'CTRL+SHIFT+S': 'strikethrough',
  107. 'CTRL+BACKSLASH': 'removeFormat',
  108. 'CTRL+SHIFT+L': 'justifyLeft',
  109. 'CTRL+SHIFT+E': 'justifyCenter',
  110. 'CTRL+SHIFT+R': 'justifyRight',
  111. 'CTRL+SHIFT+J': 'justifyFull',
  112. 'CTRL+SHIFT+NUM7': 'insertUnorderedList',
  113. 'CTRL+SHIFT+NUM8': 'insertOrderedList',
  114. 'CTRL+LEFTBRACKET': 'outdent',
  115. 'CTRL+RIGHTBRACKET': 'indent',
  116. 'CTRL+NUM0': 'formatPara',
  117. 'CTRL+NUM1': 'formatH1',
  118. 'CTRL+NUM2': 'formatH2',
  119. 'CTRL+NUM3': 'formatH3',
  120. 'CTRL+NUM4': 'formatH4',
  121. 'CTRL+NUM5': 'formatH5',
  122. 'CTRL+NUM6': 'formatH6',
  123. 'CTRL+ENTER': 'insertHorizontalRule',
  124. 'CTRL+K': 'showLinkDialog'
  125. },
  126. mac: {
  127. 'CMD+Z': 'undo',
  128. 'CMD+SHIFT+Z': 'redo',
  129. 'TAB': 'tab',
  130. 'SHIFT+TAB': 'untab',
  131. 'CMD+B': 'bold',
  132. 'CMD+I': 'italic',
  133. 'CMD+U': 'underline',
  134. 'CMD+SHIFT+S': 'strikethrough',
  135. 'CMD+BACKSLASH': 'removeFormat',
  136. 'CMD+SHIFT+L': 'justifyLeft',
  137. 'CMD+SHIFT+E': 'justifyCenter',
  138. 'CMD+SHIFT+R': 'justifyRight',
  139. 'CMD+SHIFT+J': 'justifyFull',
  140. 'CMD+SHIFT+NUM7': 'insertUnorderedList',
  141. 'CMD+SHIFT+NUM8': 'insertOrderedList',
  142. 'CMD+LEFTBRACKET': 'outdent',
  143. 'CMD+RIGHTBRACKET': 'indent',
  144. 'CMD+NUM0': 'formatPara',
  145. 'CMD+NUM1': 'formatH1',
  146. 'CMD+NUM2': 'formatH2',
  147. 'CMD+NUM3': 'formatH3',
  148. 'CMD+NUM4': 'formatH4',
  149. 'CMD+NUM5': 'formatH5',
  150. 'CMD+NUM6': 'formatH6',
  151. 'CMD+ENTER': 'insertHorizontalRule',
  152. 'CMD+K': 'showLinkDialog'
  153. }
  154. }
  155. },
  156. // default language: en-US
  157. lang: {
  158. 'en-US': {
  159. font: {
  160. bold: 'Bold',
  161. italic: 'Italic',
  162. underline: 'Underline',
  163. strikethrough: 'Strikethrough',
  164. clear: 'Remove Font Style',
  165. height: 'Line Height',
  166. name: 'Font Family',
  167. size: 'Font Size'
  168. },
  169. image: {
  170. image: 'Picture',
  171. insert: 'Insert Image',
  172. resizeFull: 'Resize Full',
  173. resizeHalf: 'Resize Half',
  174. resizeQuarter: 'Resize Quarter',
  175. floatLeft: 'Float Left',
  176. floatRight: 'Float Right',
  177. floatNone: 'Float None',
  178. dragImageHere: 'Drag an image here',
  179. selectFromFiles: 'Select from files',
  180. url: 'Image URL',
  181. remove: 'Remove Image'
  182. },
  183. link: {
  184. link: 'Link',
  185. insert: 'Insert Link',
  186. unlink: 'Unlink',
  187. edit: 'Edit',
  188. textToDisplay: 'Text to display',
  189. url: 'To what URL should this link go?',
  190. openInNewWindow: 'Open in new window'
  191. },
  192. video: {
  193. video: 'Video',
  194. videoLink: 'Video Link',
  195. insert: 'Insert Video',
  196. url: 'Video URL?',
  197. providers: '(YouTube, Vimeo, Vine, Instagram, or DailyMotion)'
  198. },
  199. table: {
  200. table: 'Table'
  201. },
  202. hr: {
  203. insert: 'Insert Horizontal Rule'
  204. },
  205. style: {
  206. style: 'Style',
  207. normal: 'Normal',
  208. blockquote: 'Quote',
  209. pre: 'Code',
  210. h1: 'Header 1',
  211. h2: 'Header 2',
  212. h3: 'Header 3',
  213. h4: 'Header 4',
  214. h5: 'Header 5',
  215. h6: 'Header 6'
  216. },
  217. lists: {
  218. unordered: 'Unordered list',
  219. ordered: 'Ordered list'
  220. },
  221. options: {
  222. help: 'Help',
  223. fullscreen: 'Full Screen',
  224. codeview: 'Code View'
  225. },
  226. paragraph: {
  227. paragraph: 'Paragraph',
  228. outdent: 'Outdent',
  229. indent: 'Indent',
  230. left: 'Align left',
  231. center: 'Align center',
  232. right: 'Align right',
  233. justify: 'Justify full'
  234. },
  235. color: {
  236. recent: 'Recent Color',
  237. more: 'More Color',
  238. background: 'BackColor',
  239. foreground: 'FontColor',
  240. transparent: 'Transparent',
  241. setTransparent: 'Set transparent',
  242. reset: 'Reset',
  243. resetToDefault: 'Reset to default'
  244. },
  245. shortcut: {
  246. shortcuts: 'Keyboard shortcuts',
  247. close: 'Close',
  248. textFormatting: 'Text formatting',
  249. action: 'Action',
  250. paragraphFormatting: 'Paragraph formatting',
  251. documentStyle: 'Document Style'
  252. },
  253. history: {
  254. undo: 'Undo',
  255. redo: 'Redo'
  256. }
  257. }
  258. }
  259. };
  260. return settings;
  261. });