Kirby YAKME - yet another kirby markdown editor

You have added a hide button feature. I think it would be better to have a buttons feature where you add what you buttons you need, instead of hide what you don’t. :slight_smile:

Here is why:

  • If you hide buttons and the plugin is updated with new buttons you need to hide the new buttons as well.
  • If you add the buttons instead of hidingthem you have other benefits as well. For example it would be possible to have a kind of sort feature where the buttons appear in the order you add them to the blueprint.

Maybe you don’t want to change it now when you have set it but now you have my thoughts on it anyway. :slight_smile:

1 Like

Also, all the other textarea replacements function that way :wink:

Thx - I have a master degree in classic typography (no kidding… higher school of visual arts, way back in 1997!) but didn’t mention my mistake.

Will fix it in the next update!

1 Like

##New version - UPDATE - 1.3.1

@Thiousi / @jenstornell / @sandbox

You can now choose to hide or show any button… the order can not be set; I am a simple developer, offering simple solutions - hide or show is just a CSS class


###YAKME - hide

  yakme_example_1:
    label: Yakme - Example
    type: yakme
    hide:
      - kirby
      - font
      - wysiwyg
      - table
      - split
      - fullscreen


###YAKME - show

  yakme_example_2:
    label: Yakme - Example
    type: yakme
    show:
      - bold
      - italic
      - heading
      - list
      - kirby
      - preview


###YAKME - hide | show

  yakme_example_3:
    label: Yakme - Example
    type: yakme
    hide:
      - kirby
      - list
    show:
      - bold
      - italic
      - list
      - kirby
      - preview


Remember; even when a button is hidden, you can access it’s functionality by manually entering the markdown-code or pressing the shortcut (see later in this document) for it.

In order to avoid conflicts, when both hide and show are set, show will always win (see examples above).

Also you can add some (general) preferences by setting them in config.php. Finally you can toggle each individual field-preference with the font and wysiwyg buttons (which are saved per field).

I don’t know if you @1n3JgKl9pQ6cUMrW are interested in this but I just want to report that there is a bug when using your plugin with the kirby-builder.

It seems that the html is not parsed back to markdown when editing the field.

See:

Cheers

Edit: I also tried the enhanced textarea plugin and there is the same problem so I guess the kirby-builder plugin is responsible for that behavior?

I think you’re supposed to click the “OK” button at the bottom of your section before clicking on the “Save” button at the end of the form in the builder field. This is inherited from the structure field but gets really annoying when you forget about it and click save… and lose everything you just wrote!

Oh yes you are definitely right but this just happened when I recorded the GIF. It is the same result when hitting “OK -> then Save”

Hello @1n3JgKl9pQ6cUMrW … I was looking to the code as I would love to add custom kirbytag buttons and I found the solution on kirby.js. As I don’t want to edit the original code (for updates!) I was wandering if is possible to add custom buttons through the main kirby config file.

Hope you or someone else could help me… I don’t know from where to start…

Thanks

I am on vacation, discovering the outlands of northern Thailand by bike right now.

Will be back, supporting Kirby and this plugin in about one month!

1 Like

Wooooow…! Enjoy your trip!

This seems to be a theme for us Kirby developers…

1 Like

Hi! @1n3JgKl9pQ6cUMrW i hope you’re enjoying your trip through Thailand right now, and you don’t read this until your back home.

I’ve got an strange behavior with Yakme when i upload images. If i write some text without saving changes and inmediately I upload an image (with the lateral panel option) the page is been reload and the changes are missed. So this can be problematic with editors trying to write pages and losing changes. Maybe is a bug?

Thanks!

You are absolutely right about this - but I don’t now if I should implement an “auto save” option, or something;

Kirbys default behavior is that it “auto saves” text corrections in the localstorage (I think) and show a “you have unsaved changes” everytime an AJAX-call is made (which resets the page).

I can do the same, but I don’t know how hard it is to create such a function…


On the other hand; I noticed that Kirby is saving text-corrections after an AJAX-call, but not styling adjustments.

For example, try this;

  1. Enter “Lorem ipsum” in a default textarea
  2. Upload an image
  3. The text is still there (autosaved)

  1. Enter “Lorem ipsum” in a default textarea
  2. Press save (the text is saved)
  3. Make “Lorem” bold and “ipsum” italic
  4. Upload an image
  5. The styling is gone

So Kirby itself is not 100% doing the samething, everytime… what should I do?

Well, imho loosing a bit of formatting is usually not that big a deal. On the other hand loosing a text you just typed is awful.
If it’s as easy as turning a setting on (SimpleMDE has its own autosave it seems) then go for it.

1 Like

Autosave FTW! Even when the behavior of kirby doesn’t do it always i think is important to maintain the changes of the user when it’s possible. If not we can create upsetting situations.

I mean, i guess you use a code editor, you can think about how you would feel when you write a couple of lines, then change to another file to check something and then go back to the first file where the unsaved changes have lost. For me that would be like “F$ÇK”. I know is not the same thing but the feeling with the editor could be similar.

I like the auto-save option, but it’s not that easy to activate.

The field-editor has it’s own native auto-save option, but it conflicts with Kirbys auto-save option.

I did solve that, but now it auto-saves… even when you reload the page (without pressing save) the most recent text is shown…

It auto saves every 5 seconds right now, but you don’t want to save / store that text, when you press reload and not save

Gimme some time :slight_smile:

Of course! The good work needs its time :slight_smile:

It’s bèta - not good :slight_smile:

But I found a way to save unsaved-work… I’ll test it and update the code once ready (this week, I hope).

Kirby - YAKME

Version 1.4.5 - 2016-09-22

  • Autosave (optional) of every YAKME-field.
  • Number of keystrokes are shown in the status-area.
  • Minor fixes and tunes.

Config

By default, no config is needed. But you can set the styling / height of the YAKME-field and perform an image-check;

c::set('yakme_height', 0);

This will set an “auto-height” for every field; the more the content, the larger the field.

c::set('yakme_height', 480);

This will set a “fixed-height” for every field; the size is in pixels and when the content becomes to large, a scrollbar will appear.

The settings defaults to 320px - so that’s used when no settings are available.


c::set('yakme_images', 0);

Markdown-images will not be checked for validity, when rendered in the live-preview.

c::set('yakme_images', 1);

A check will be performed when previewing markdown-images. When an images does not exist, a error-sign is showed.

Please note, Kirby image-tags can not (yet) be validated.

c::set('yakme_autosave', 1);

Autosave the text (while uploading / removing files) or not.

The text is saved in the browser-memory (not on the server or local storage) when autosaving is set to 1.

If you don’t want to autosave the text, set this preference to 0.

Please remember; don’t rely 100% on autosave - when you really leave the page (or reload the tab) the autosaved text is gone (sometimes Kirby itself will try to restore it, but again; don’t count on it).

Autosave works fine when editing the textfield, uploading / removing files, etc… But when you have a lot of edited text, it’s always better to press save yourself (and make backups).


1 Like

Great plugin, I did notice one minor issue with the show/hide feature (didn’t see a issue reporting feature on GitHub, so assuming I do it here).

  1. Should the dividers be going away the moment I hide something as the intended effect? Or is that a bug?

  2. Is hiding kirby-email bugged right now? Looks like the other ones like kirby-video work, though.