laravel - how can I edit image in tiny mce editor -
i using tinymce text editor in laravel , have 2 textareas in index.blade.php file.
when adding images , text, should added database perfectly. when click edit button not working.
i try show editor colorbox. unable show images , text textarea. how can solve it.
index.blade.php
<div class="middle-containers"> <form method="post" id="form" action="{{url::to('project/postfaq')}}" enctype="multipart/form-data"> <ul class="middle-left" style="width:74%;"> @foreach($faqs $key=>$faq) <li> <label class="titl-left-side col-md-3" >{{trans('messages.faq')}} #{{$key+1}}</label> <div class="col-md-9"> <ul class="amont-bar"> <li> <a class="delete" style="float: right;" onclick="confirmation('{{$faq->id}}')" title="delete faq"> <span class="fa fa-close"></span> {{trans('messages.delete')}} </a> <a class="delete popupedit" style="float: right; margin-right: 7px;" data-id="{{$faq->id}}" title="edit faq"> <span class="fa fa-edit"></span> {{trans('messages.edit')}} </a> <br> <br><br> <div style="width:100%;"> <h3 class="mb0" style="margin-left:2%;"> {{$faq->question}} </h3> </div> <div class="pldg-titl" style="width:100%;"> <p style="line-height:1.8">{{$faq->answer}}</p> </div> </li> </ul> </div> </li> @endforeach </ul> <input type="hidden" value="{{$projectdetails->id}}" name="id"> <input type="hidden" value="{{$userid}}" name="userid"> <ul class="middle-left"> <li> <label class="titl-left-side col-md-3" >{{trans('messages.question')}}</label> <div class="col-md-9"> <div> <input id="project_photo" style="width: 100%;" name="question" type="text" class="@if($errors->has('question')) has-error @endif"> </div> @if ($errors->has('question')) <p class="help-block">{{ $errors->first('question') }}</p> @endif </div> </li> <li> <label class="titl-left-side col-md-3" >{{trans('messages.answer')}}</label> <div class="col-md-9"> <p style='padding-top:10px;padding-bottom:10px;font-size:12px;line-height:1.5;'>{{trans('messages.projectdescriptioninfo')}} </p> </p> <textarea rows='10' id='edit' style="margin-top: -230px;" name="answer01" class="edit01 required input-editor @if($errors->has('answer')) has-error @endif"> @if(input::old('answer')!=''){{ input::old('answer')}}@else {{$projectdetails->answer}}@endif </textarea> @if ($errors->has('answer')) <p class="help-block help-editor">{{ $errors->first('answer') }}</p> @endif </div> </li> <!-- <li> <label class="titl-left-side col-md-3" >{{trans('messages.answer')}}</label> <div class="col-md-9"> <p style='padding-top:10px;padding-bottom:10px;font-size:12px;line-height:1.5;'>{{trans('messages.projectdescriptioninfo')}} </p> <textarea rows='10' name="answer" class="editable @if($errors->has('answer')) has-error @endif"></textarea> @if ($errors->has('answer')) <p class="help-block">{{ $errors->first('answer') }}</p> @endif </div> </li> --> <li class='banner-section'> <input type="submit" class='btns-green' style='line-height: 0px; min-height: 45px; margin-left: 42%;' value="{{trans('messages.submit')}}"> </li> </ul> </form> <div class="middle-right"> <li id="step-2-sidebar-help" class="panel video" style="display: list-item;"> <a class="school-tout" target="_blank" href="{{url::to('pages')}}/awesome-video"> <img src="{{url::to('images/vid.png');}}"> <span class="awsme-area"> <span>{{trans('messages.howto')}}:</span> {{trans('messages.makevideo')}} </span> </a> <h5>{{trans('messages.importantreminder')}}</h5> <p> {{trans('messages.importantreminderinfo1')}} </p> <p>{{trans('messages.importantreminderinfo2')}}</p> <p> {{trans('messages.importantreminderinfo3')}} <a class="has-icon popup" target="_blank" href="#">{{trans('messages.soundcloud')}}</a> , <a class="has-icon popup" target="_blank" href="#">{{trans('messages.vimeomusicstore')}}</a> , <a class="has-icon popup" target="_blank" href="#">{{trans('messages.freemusicarchive')}}</a> , {{trans('messages.and')}} <a class="has-icon popup" target="_blank" href="#">{{trans('messages.ccmixter')}}</a> . </p> </li> </div> </div> <div style="width:500px;" > <form autocomplete="off" method="post" name="myform" action="{{url::to('project/posteditfaq')}}" class="myform103 form_container left_label"> <style> .none{ display:none; } </style> <fieldset> <h2>{{trans('messages.edit')}} {{trans('messages.faq')}}</h2> <ul> <input type='hidden' name='id' value="{{$projectdetails->id}}"> <input type='hidden' name='projectid' value="{{$projectdetails->projectid}}"> <li> <div class="form_grid_12"> <label class="field_title">{{trans('messages.question')}}</label> <div class="form_input"> <div class="form_grid_8 alpha"> <input name="question" type="text" id="title" value="{{{$projectdetails->question}}}" class="required" style="width: 100%;"> </div> <p class="help-block none" id="titleerror">question field required!</p> <span class="clear"></span> </div> </div> </li> <li> <div class="form_grid_12"> <label class="field_title">{{trans('messages.answer')}}</label> <div class="form_input"> <div class="form_grid_8 alpha"> <textarea name="answer02" id="updateeditor" class="edit02">{{{$projectdetails->answer}}}</textarea> </div> <p class="help-block none" id="descriptionerror">answer field required!</p> <span class="clear"></span> </div> </div> </li> <li> <div class="form_grid_12"> <div class="form_input"> <button name="submit" type="submit" class="btn_small btn_blue" id="submitreward"><span>{{trans('messages.submit')}}</span></button> </div> </div> </li> </ul> </fieldset> </form> </div> <ul class="alt-tools right list-inline ml1 mt2"> <li class="mr2"> <i class="fa fa-close"></i> <a class="inline-block py1 delete-project grey-dark h5" href="{{url::to('project/delete');}}/{{$projectdetails->id}}" title="delete project"> {{trans('messages.deleteproject')}} </a></li> </ul> </div>
<script> $(document).ready(function () { $(".popupedit").click(function() { var $stuff = $('.myform103'); $.colorbox({inline:true, href:$stuff,open:true}); var valid = $(this).attr('data-id'); $.ajax({ type: "post", url: "edit", data: 'valid='+valid, success: function (data) { $('#title').val(data['question']); $('.mcecontentbody').tinymce().execcommand('mceinsertcontent',false,'<img src="'+sr+'"/>'); } }); }); <script type="text/javascript"> tinymce.init({ selector: ".edit01", mode : "textareas", elements :"answer01", plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste jbimages" ], toolbar: "insertfile undo redo | styleselect | bold italic | link image jbimages", relative_urls: false }); </script> <script type="text/javascript"> tinymce.init({ selector: ".edit02", mode : "textareas", elements :"answer02", plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste jbimages" ], toolbar: "insertfile undo redo | styleselect | bold italic | link image jbimages", relative_urls: false }); </script>
Comments
Post a Comment