Kirby3 editor plugin text null after save

Hi there,

I’m just starting out with kirby. I have installed the editor plugin and am trying to save some blocks. I use Kirby 3.3.4 and editor 1.0.2.

This is my blueprint:

title: Textblock mit Überschrift
icon: text

fields:
  headline:
    type: text
  text:
    label: Editor
    type: editor
    files:
      query: page.parent
    uploads:
      parent: page.parent
      template: image

No matter what I do, how many blocks I save, this is the stored text file:

Title: intro

----

Headline: Hier eine Überschrift Block

----

Text: null

There are no errors in the JS console and I can see the content transmitted via XHR.

I’m developing on a docker setup and have moved index.php, media and assets to public folder which is the webserver’s root. In the index.php I mapped the roots like this:

$kirby = new Kirby(
    [
        'roots' => [
            'media' => __DIR__ . '/media',
        ],
        'urls' => [
            'media' => url('media'),
        ]
    ]
);

Has anybody had this effect?

Hi @sascha-schieferdecke and welcome to Kirby!

Is it possible your indentation is off? Shouldn’t it be:

title: Textblock mit Überschrift
icon: text

fields:
  headline:
    type: text
  text:
    label: Editor
    type: editor
  files:
    query: page.parent
  uploads:
    parent: page.parent
    template: image

Also; I wouldn’t use files as it collides with a reserved $page->files()-method that you might need later on in templates: https://getkirby.com/docs/reference/objects/page/files

Hi there and thanks for your input!

As I understood from the documentation this configures the editor where to look for files and place uploads, in this case use the folder of the parent page. That works, the uploads are placed in the parent folder. So it seems the indentation isn’t the problem here.

Must be something else. The content is not getting saved. I can see it in the request payload, but the JSON response of the application doesn’t contain it:

Request:
image

Response:

Yes, the indentation is not a problem here.

Does other content from other fields get saved?

Yes, the simple text field gets saved. I took parts from the demokit to test it as well. Editor is used for blog articles there. After saving the content of an existing article, all editor content is null.

I fiddled around a bit more with Kirby and am quite impressed in many areas. I created a template using Builder that works for now. But I’m quite keen on testing the editor.
Maybe there’s some server setting that’s causing problems? I am using a Docker based enviroment: https://github.com/S1SYPHOS/Docker-Kirby-Starter-Kit

Looks okay in my opinion. My public folder does contain assets, the media folder and index.php.

upstream _php {
    server unix:/sock/docker.sock;
}

server {
    server_name localhost;
    error_log  /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log;
    index index.php;
    root /app/public;

    client_body_in_file_only clean;
    client_body_buffer_size 32K;

    client_max_body_size 300M;

    sendfile on;
    send_timeout 300s;

    location /assets {
        try_files $uri =404;
        expires max;
        access_log off;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    location / {
        try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass _php;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

I’ll try and test in my own environment.

Edit: I did a quick test in a fresh demokit and when I save a blog post with changes, everything is still in place.

I’m using Laravel Valet, no a Docker environment, though. And since I’m not familiar with Docker, I can’t tell if there might be a problem.

Okay, then it’s probably an issue with the docker environment, I will switch to another set up. If I might be allowed the suggestion, it would be really cool if you’d provide an official docker container to get a quick start for new users. It’s not like I am unable to install a LAMP/LEMP/WAMP whatever, but docker has become my preferred local development environment over the years. And I guess there are many others users using docker too.

Thanks a lot for your help :+1:

If you don’t want to install anything, you can use PHP’s built in server with the router script:

php -S localhost:8000 kirby/router.php

Yeah I know, but this thing has to run with docker in production anyway, so I will try to solve it with docker. Thanks!

Guess it’s time to get a bit deeper into Docker.

Ok, just an update. It’s not about the environment. I just cloned the demokit, spun up a simple Docker image generated by https://phpdocker.io/ and everything works as intended. In my test project I debugged the process up to the point that I can see the data is lost when validating the Page on saving (the class is ModelWithContent method update). Will investigate further.

a version available for a few days my srcset plugin might have cause the value to be null. please update if you use it.

1 Like

Yes, that solves it! Thanks for the heads-up. :+1: