Просмотр файла public/assets/js/markitup-set.js

Размер файла: 6.05Kb
  1. // ----------------------------------------------------------------------------
  2. // markItUp bb-code setting!
  3. // ----------------------------------------------------------------------------
  4. mySettings = {
  5. nameSpace: 'markItUpBlock',
  6. previewParserPath: '/bbcode', // path to your BBCode parser
  7. previewAutoRefresh: false,
  8. onTab: {keepDefault: false, openWith: ' '},
  9. markupSet: [
  10. {title: 'Жирный текст', name: '<i class="bi bi-type-bold"></i>', className: 'bb-bold', key: 'B', openWith: '[b]', closeWith: '[/b]'},
  11. {title: 'Наклонный текст', name: '<i class="bi bi-type-italic"></i>', className: 'bb-italic', key: 'I', openWith: '[i]', closeWith: '[/i]'},
  12. {title: 'Подчеркнутый текст', name: '<i class="bi bi-type-underline"></i>', className: 'bb-underline', key: 'U', openWith: '[u]', closeWith: '[/u]'},
  13. {title: 'Зачеркнутый текст', name: '<i class="bi bi-type-strikethrough"></i>', className: 'bb-strike', key: 'S', openWith: '[s]', closeWith: '[/s]'},
  14.  
  15. {separator: '---------------'},
  16. {title: 'Ссылка', name: '<i class="bi bi-link"></i>', className: 'bb-link', key: 'L', openWith: '[url=[![' + 'Ссылка' + ':!:https://]!]]', closeWith: '[/url]', placeHolder: 'Текст ссылки...'},
  17.  
  18. {title: 'Изображение', name: '<i class="bi bi-image"></i>', className: 'bb-image', openWith: '[img][![' + 'URL изображения' + ':!:https://]!]', closeWith: '[/img]'},
  19.  
  20. {title: 'Видео', name: '<i class="bi bi-play-btn"></i>', className: 'bb-youtube', openWith: '[youtube][![' + 'Ссылка на видео с youtube' + ':!:https://]!]', closeWith: '[/youtube]'},
  21. {title: 'Цвет', name: '<i class="bi bi-palette"></i>', className: 'bb-color', openWith: '[color=[![' + 'Код цвета' + ']!]]', closeWith: '[/color]',
  22. dropMenu: [
  23. {name: 'Yellow', openWith: '[color=#ffd700]', closeWith: '[/color]', className: 'col1-1'},
  24. {name: 'Orange', openWith: '[color=#ffa500]', closeWith: '[/color]', className: 'col1-2'},
  25. {name: 'Red', openWith: '[color=#ff0000]', closeWith: '[/color]', className: 'col1-3'},
  26.  
  27. {name: 'Blue', openWith: '[color=#0000ff]', closeWith: '[/color]', className: 'col2-1'},
  28. {name: 'Purple', openWith: '[color=#800080]', closeWith: '[/color]', className: 'col2-2'},
  29. {name: 'Green', openWith: '[color=#00cc00]', closeWith: '[/color]', className: 'col2-3'},
  30.  
  31. {name: 'Magenta', openWith: '[color=#ff00ff]', closeWith: '[/color]', className: 'col3-1'},
  32. {name: 'Gray', openWith: '[color=#808080]', closeWith: '[/color]', className: 'col3-2'},
  33. {name: 'Cyan', openWith: '[color=#00ffff]', closeWith: '[/color]', className: 'col3-3'}
  34. ]},
  35.  
  36. {separator: '---------------'},
  37. {title: 'Размер текста', name: '<i class="bi bi-type"></i>', className: 'bb-size', openWith: '[size=[![' + 'Размер текста от 1 до 5' + ']!]]', closeWith: '[/size]',
  38. dropMenu :[
  39. {name: 'x-small', openWith: '[size=1]', closeWith: '[/size]'},
  40. {name: 'small', openWith: '[size=2]', closeWith: '[/size]'},
  41. {name: 'medium', openWith: '[size=3]', closeWith: '[/size]'},
  42. {name: 'large', openWith: '[size=4]', closeWith: '[/size]'},
  43. {name: 'x-large', openWith: '[size=5]', closeWith: '[/size]'}
  44. ]},
  45.  
  46. {title: 'По центру', name: '<i class="bi bi-text-center"></i>', className: 'bb-center', openWith: '[center]', closeWith: '[/center]'},
  47. {title: 'Спойлер', name: '<i class="bi bi-plus-lg"></i>', className: 'bb-spoiler', openWith: '[spoiler=[![' + 'Заголовок спойлера' + ']!]]', closeWith: '[/spoiler]', placeHolder: 'Текст спойлера...'},
  48. {
  49. title: 'Стикер',
  50. name: '<i class="bi bi-emoji-smile"></i>',
  51. className: 'bb-sticker',
  52. beforeInsert: function () {
  53. const stickerModal = $('#stickersModal');
  54.  
  55. if (stickerModal.length) {
  56. stickerModal.modal('show');
  57.  
  58. return false;
  59. }
  60.  
  61. $.ajax({
  62. dataType: 'json', type: 'get', url: '/stickers/modal',
  63. success: function (data) {
  64. if (data.success) {
  65. $('body').append(data.stickers);
  66. }
  67.  
  68. $('#stickersModal').modal('show')
  69. }
  70. });
  71. }
  72. },
  73.  
  74. {separator: '---------------'},
  75. {title: 'Скрытый контент', name: '<i class="bi bi-eye-slash"></i>', className: 'bb-hide', openWith: '[hide]', closeWith: '[/hide]'},
  76. {title: 'Цитата', name: '<i class="bi bi-chat-quote"></i>', className: 'bb-quote', openWith: '[quote]', closeWith: '[/quote]'},
  77. {title: 'Исходный код', name: '<i class="bi bi-code-slash"></i>', className: 'bb-code', openWith: '[code]', closeWith: '[/code]'},
  78.  
  79. {separator: '---------------'},
  80. {title: 'Маркированный список', name: '<i class="bi bi-list-ul"></i>', className: 'bb-unorderedlist', multiline:true, openBlockWith: '[list]\n', closeBlockWith: '\n[/list]', placeHolder: 'Элемент списка'},
  81. {title: 'Нумерованный список', name: '<i class="bi bi-list-ol"></i>', className: 'bb-orderedlist', multiline:true, openBlockWith: '[list=1]\n', closeBlockWith: '\n[/list]', placeHolder: 'Элемент списка'},
  82.  
  83. {separator: '---------------'},
  84. {title: 'Очистка тегов', name: '<i class="bi bi-eraser"></i>', className: 'bb-clean', replaceWith:function(markitup) { return markitup.selection.replace(/\[(.*?)]/g, '') } },
  85. {title: 'Обрезка страницы', name: '<i class="bi bi-scissors"></i>', className: 'bb-cutpage', openWith: '[cut]'},
  86. {title: 'Просмотр', name: '<i class="bi bi-check2"></i>', classname: 'bb-preview', call: 'preview'}
  87. ]
  88. };