Выполнение var video_overview = $ ('# upl_overview_id'). Summernote ('code'); возвращает объект не html текст - PullRequest
0 голосов
/ 16 января 2020

Моя инициализация:

function init_video_summernote(id_val,my_placeholder,my_width,my_height)
{
          $( id_val ).summernote('destroy');
           $( id_val ).summernote(
           {
               placeholder: my_placeholder,
                //height: my_height,
                //width:  my_width,
             toolbar: [
               ['style', ['style']],
               ['font', ['bold', 'italic', 'underline', 'clear']],
               ['fontname', ['fontname']],
               ['para', ['ul', 'ol', 'paragraph']],
               ['height', ['height']],
               ['table', ['table']],
               ['view', ['fullscreen', 'codeview']],
               ['help', ['help']]
             ],
             lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],
             fontNames: [
               'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New',
               'Helvetica Neue', 'Impact', 'Lucida Grande',
               'Tahoma', 'Times New Roman', 'Verdana'
             ],
             styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
             lang: {
             'en-US': {
               font: {
                 bold: 'Bold',
                 italic: 'Italic',
                 underline: 'Underline',
                 clear: 'Remove Font Style',
                 height: 'Line Height',
                 name: 'Font Family'
               },
               image: {
                 image: 'Picture',
                 insert: 'Insert Image',
                 resizeFull: 'Resize Full',
                 resizeHalf: 'Resize Half',
                 resizeQuarter: 'Resize Quarter',
                 floatLeft: 'Float Left',
                 floatRight: 'Float Right',
                 floatNone: 'Float None',
                 shapeRounded: 'Shape: Rounded',
                 shapeCircle: 'Shape: Circle',
                 shapeThumbnail: 'Shape: Thumbnail',
                 shapeNone: 'Shape: None',
                 dragImageHere: 'Drag image here',
                 dropImage: 'Drop image',
                 selectFromFiles: 'Select from files',
                 url: 'Image URL',
                 remove: 'Remove Image'
               },
               link: {
                 link: 'Link',
                 insert: 'Insert Link',
                 unlink: 'Unlink',
                 edit: 'Edit',
                 textToDisplay: 'Text to display',
                 url: 'To what URL should this link go?',
                 openInNewWindow: 'Open in new window'
               },
               table: {
                 table: 'Table'
               },
               hr: {
                 insert: 'Insert Horizontal Rule'
               },
               style: {
                 style: 'Style',
                 normal: 'Normal',
                 blockquote: 'Quote',
                 pre: 'Code',
                 h1: 'Header 1',
                 h2: 'Header 2',
                 h3: 'Header 3',
                 h4: 'Header 4',
                 h5: 'Header 5',
                 h6: 'Header 6'
               },
               lists: {
                 unordered: 'Unordered list',
                 ordered: 'Ordered list'
               },
               options: {
                 help: 'Help',
                 fullscreen: 'Full Screen',
                 codeview: 'Code View'
               },
               paragraph: {
                 paragraph: 'Paragraph',
                 outdent: 'Outdent',
                 indent: 'Indent',
                 left: 'Align left',
                 center: 'Align center',
                 right: 'Align right',
                 justify: 'Justify full'
               },
               color: {
                 recent: 'Recent Color',
                 more: 'More Color',
                 background: 'Background Color',
                 foreground: 'Foreground Color',
                 transparent: 'Transparent',
                 setTransparent: 'Set transparent',
                 reset: 'Reset',
                 resetToDefault: 'Reset to default'
               },
               shortcut: {
                 shortcuts: 'Keyboard shortcuts',
                 close: 'Close',
                 textFormatting: 'Text formatting',
                 action: 'Action',
                 paragraphFormatting: 'Paragraph formatting',
                 documentStyle: 'Document Style'
               },
               history: {
                 undo: 'Undo',
                 redo: 'Redo'
               }
             }
           }
       } );
   }

Когда я выполняю этот код, чтобы получить html для хранения в последующей вставке БД.

var video_overview = $('#upl_overview_id').summernote('code');
console.log('OVERVIEW:'+video_overview);

Этот фрагмент кода вызывается из в функции отправки события Dropzone.

В выводе консоли я получаю следующее:

ОБЗОР: [объект объекта] Вместо текста для хранения в БД какие-либо идеи, которые мне здесь не хватает?

1 Ответ

0 голосов
/ 16 января 2020

Не берите в голову, что это было вызвано включением Summernote. js более одного раза

...