mention.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global console, window */
  6. import global from '@ckeditor/ckeditor5-utils/src/dom/global';
  7. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  8. import Mention from '../../src/mention';
  9. import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
  10. import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
  11. import Font from '@ckeditor/ckeditor5-font/src/font';
  12. ClassicEditor
  13. .create( global.document.querySelector( '#editor' ), {
  14. plugins: [ ArticlePluginSet, Underline, Font, Mention ],
  15. toolbar: [
  16. 'heading',
  17. '|', 'bulletedList', 'numberedList', 'blockQuote',
  18. '|', 'bold', 'italic', 'underline', 'link',
  19. '|', 'fontFamily', 'fontSize', 'fontColor', 'fontBackgroundColor',
  20. '|', 'insertTable',
  21. '|', 'undo', 'redo'
  22. ],
  23. image: {
  24. toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
  25. },
  26. mention: {
  27. feeds: [
  28. {
  29. marker: '@',
  30. feed: [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ]
  31. },
  32. {
  33. marker: '#',
  34. feed: [
  35. '#a01', '#a02', '#a03', '#a04', '#a05', '#a06', '#a07', '#a08', '#a09', '#a10',
  36. '#a11', '#a12', '#a13', '#a14', '#a15', '#a16', '#a17', '#a18', '#a19', '#a20'
  37. ]
  38. }
  39. ]
  40. }
  41. } )
  42. .then( editor => {
  43. window.editor = editor;
  44. } )
  45. .catch( err => {
  46. console.error( err.stack );
  47. } );