PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, December 30, 2021

[FIXED] Laravel 8.x - Creating copies of a toast markdown editor in laravel blade

 December 30, 2021     laravel, toast-ui-editor     No comments   

Issue

This is a noobie question . I am trying to create multiple copies of toastui editor using the following code, but i am not getting the desired output. Please tell me what i am doing wrong here.

<div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            @for($i=0;$i<10;$i++)
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
            <div class="flex flex-col space-y-2">
    <label for="editor" class="text-gray-600 font-semibold">Content</label>
    <div id="editor" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm"></div>
</div>
            </div>
            @endfor
        </div>
    </div>

Solution

        @for($i=0;$i<10;$i++)
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="flex flex-col space-y-2">
                    <label for="editor" class="text-gray-600 font-semibold">Content</label>
                    <div id="editor-{{$i}}" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm"></div>
                </div>
            </div>
        @endfor

In script tag :

 for(let i=0; i<10; i++){
      const editor = new toastui.Editor({
        el: document.querySelector('#editor'+i),
        previewStyle: 'vertical',
        height: '500px',
        initialValue: content
      });
    }


Answered By - Recep Gümüş
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing