Vinelab / laravel-editor

Markdown Text Editor (WYSIWYG) with social network embeds support and a nifty json output
53 stars 15 forks source link

display content in editor area. #10

Open Xplorer001 opened 9 years ago

Xplorer001 commented 9 years ago

When I pass $input as raw html to Editor::content($input) and then display the editor, it does not show the content. I'm trying to use edit to edit content which is already there on the page.

I do not know if this is a bug or I'm not able to figure out how to use it. I'm new to laravel/php and web in general. I had no problem in setting up the editor and getting json responses. It is clean and beautiful. Please help.

Mulkave commented 9 years ago

Editor::content($input) is intended to be used to get the content out of a rendered editor as shown in Retrieving Content section in docs. As for rendering the editor with content inside it you would use Editor::view($content) which is the raw content retrieved and probably saved into your database. Will update the docs indicating the following, please let me know if you get it working.

Xplorer001 commented 9 years ago

yes I have used the same function. the code looks like below:

<?php 

$content = '<html><body>'
         .'Editor Input test'
         .'<html><body>';

 ?>

{{ Form::open(['url' => '/editor', 'method' => 'POST']) }}
    {{ Editor::view($content) }}
    {{ Form::submit() }}
{{ Form::close() }}

I have passed html string to test have tried it with json as well. The editor area still appears blank. Is there anything else that is required to be configured. I'm not totally clear with the code below, please guide!

  /**
     * Get the view of the editor.
     *
     * @param  string $form The form id in which the content of this editor should exist.
     * @param  string $content Existing content.
     *
     * @return \Illuminate\View\View
     */
    public function view($content = null)
    {
        if ($content) {
            $content = Content::make($content)->markdown();
        }
        return view('vendor/laravel-editor/editor')->with(compact('content'))->render();
    }

please help.

Mulkave commented 9 years ago

@Xplorer001 sorry for any inconvenience this have caused, just tracked the issue down. Pushing an update in a bit, this is due to the requirement of mrUploader which is supposed to be optional. Thank you for reporting!

Mulkave commented 9 years ago

@Xplorer001 this should hopefully do it! Please do composer update and make sure it installs the latest version, then php artisan vendor:publish to get the latest version of the view.

Xplorer001 commented 9 years ago

@Mulkave Thanks for the editor, the support and the fix. Really appreciate it. Will test and revert!

Xplorer001 commented 9 years ago

@Mulkave The current version requires "illuminate/support": "5.*", I'm using laravel 4.2. Is there a way to install the package without updating?

Xplorer001 commented 9 years ago

For now I got it working by installing "mr-uploader" :) thanks for the help!