Giter Club home page Giter Club logo

kirby-markdown-field's People

Contributors

dependabot[bot] avatar fabianmichael avatar johannschopplich avatar luxuryluke avatar medienbaecker avatar mtsknn avatar nilshoerrmann avatar onezerodigits avatar rasteiner avatar s3ththompson avatar sylvainjule avatar thomasfahrland avatar tobimori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kirby-markdown-field's Issues

Fix incrementation when adding a new ordered li

Currently, when cursor is right after an ordered li, on click on the ordered-list button the current incrementation isn't taken into account and always insert 1. .

screen recording 2018-12-31 at 12 52 pm

While this will not cause any issue when rendered, this can be confusing for editors.

Automatic detection for link / email modals

Currently, any text selected before clicking the button will fill the text field of the modal.

We should add some automatic detection in case the selected string is an url / email, and fill the link / email field of the modal instead.

Overwritable default buttons

The old SimpleMDE field had this too and I found it pretty useful. In the site/config.php you could define:

'community.markdown-field.buttons' => ['headlines', 'bold', 'italic']

I already started with it, but I think we need to change the array_merge_recursive() function in lib/fields/markdown.php as it doesn't allow overwriting existing props. If I understand it correctly it only adds another buttons to the props array. See https://medium.com/@kcmueller/php-merging-two-multi-dimensional-arrays-overwriting-existing-values-8648d2a7ea4f

After that we should be able to just add something like this to the lib/fields/markdown.php file:

'buttons' => function() {
  return option('community.markdown-field.buttons');
}

...and this to the /config.php file:

'options' => array(
  'buttons' => ['headlines', 'bold', 'italic', 'divider', 'link', 'email', 'code', 'divider', 'ul', 'ol']
)

Toolbar Button for special characters

I am often using special whitespace characters for controlling text layout. In most cases, these are:

  • No-break space
  • Soft hyphen
  • Thin space

Maybe we should add an optional menu (just like for headline level) for inserting any of these characters and maybe some other, common special chars as well? This will especially help Windows users, who do not have convenient access for chars like the no-break space.

Cursor position resets editor on saving

When hitting CMD+S while editing, the cursor will jump back to the beginning of the editor field. It should stay where it was before and ideally also keep the current selection if there is one.

Toolbar loses its stickiness in Safari

When a blueprint has type: textarea, the toolbar’s stickiness behaves correctly (i.e. it remains stuck to the top of the viewport when text area has focus and as you scroll up and down). Yet upon setting type: markdown, this behaviour is broken, with the toolbar remaining fixed in position as you scroll. This is only the case in Safari†, in other browsers (Firefox and Chrome) everything works as expected.

† Safari Technology Preview Release 72 (Safari 12.1, WebKit 14607.1.17.1) and Safari 12.0.2

[Bug] Unable to Override 'buttons' Option from Field Blueprint

Let's say I define a 'default_markdown.yml' field blueprint, which sets out all the buttons I normally want in my standard markdown fields - it looks something like this:

buttons: 
  - headlines
    - h2
    - h3
    - h4
  - bold
  - italic
  - strikethrough
  - horizontal-rule
  - ul
  - ol
  - blockquote
  - code
  - image 
  - file 
  - pagelink
  - link
  - email

Now, somewhere else in my site, I'm going to extend this blueprint, wanting to override the 'buttons' option, because I want to use less buttons. So, I'd do something like this:

byline:
  extends: fields/default_markdown
  buttons:
    - bold
    - italic
    - link
    - pagelink
    - email

Unfortunately, when I do this, I still get all the buttons from the original field blueprint - not the overridden, shorter list...

[Feature Request] 'Query' Option for Images

The query option that we have for pagelink could also be useful for the image picker. Here is the use-case: I am building a one-pager, where each of the page's sections is a child page. Each one of these child pages will use the markdown field, and all of them will need to embed images into the field.

However, as they are all really part of the same parent page, rather than having to add a Files Section on each child page, allowing the user to upload images into each individual child page, I'd rather just add a single Files Section in the parent page. Ideally, the user would be able to then pick the images from the parent page - not from the current one.

This would be important also in avoiding multiple uploads of the same image, that are being used in different sections of the same page.

That is, of course, just one use-case, and I'm sure there will be others.

Make sure all options are working

I leave buttons out of this list, while we're figuring out how to handle them.

  • autofocus
  • counter
  • default
  • disabled
  • help
  • icon
  • label
  • maxlength
  • minlength
  • placeholder
  • required
  • size
  • translate
  • width

Fine-tune code wrapping

If single-line: wrap it with 1 backtick (current behaviour)

If multiline (code block): wrap it with 3 backticks.

[CSS] Some font-sizing / styling questions

1. Decrease monospace font-size?

Shouldn't we decrease a little the monospace font-size (font-size: $font-size-small), so that it keeps the vertical rythm of the textarea field? It currently feels a bit big.
With the change:

capture d ecran 2018-12-30 a 17 30 18

capture d ecran 2018-12-30 a 17 31 23

2. Sans-serif headlines

Currently, h6 ends up being 14px while a regular paragraph is 16px.
Shouldn't we adjust those proportions so that h6 = paragraph?

3. Font-styling options

Should we give devs the possibility to disable the scaling of headings when displaying sans-serif?

Options could become:

font:
  family: sans-serif
  scaling: false

Add "render invisibles/whitespace" option

Implement the possibility of making whitespace visible in the editor (basically what every IDE or code editor offers). This also includes line-breaks in Markdown created by adding 2 spaces at the end of a line.

Later on, we can add a button to the toolbar to toggle this feature.

Composer installation throws an error: not found

I'm not able to install it with composer.

I tried it with: composer require community/markdown-field but I get this error:

[InvalidArgumentException]                                                                                                                                                                                                
  Could not find a matching version of package community/markdown-field. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (beta). 

Disable buttons when cursor is inside a kirbytag

When the cursor / current selection is inside a kirbytag, I'd disable all the kirbytag-inserting buttons (link, email, pagelink, image, file), because as far as I know you can't nest them.

What do you think?

Kirby translations return nothing with activated plugin

Using:

  • Kirby 3.0 RC3
  • this plugin in latest version
  • no other plugins

In a setup using two languages (de & en) the t() helper returns nothing at all across different pages.

For example use the following language file with t('t.test'):

<?php

return [
  'code' => 'de',
  'default' => true,
  'direction' => 'ltr',
  'locale' => 'de_DE.utf8',
  'name' => 'Deutsch',
  'url' => '/',

  'translations' => [
    't.test' => '&larr; Hi',
  ]
];

Hide markdown.

Can the markdown characters be hidden to make this a bit more non-developer friendly? My clients would certainly be confused why "##" appears before the text once they choose to make it a heading.

Toggle formatting

Triggering a format action on an already formatted text should toggle the formatting.

bold2

Initial numbering of numbered lists

I noticed that new lines in numbered lists now automatically increment the number.
That may not be required in terms of functionality, but it's definitely nice to have.

When formatting lines of text to a numbered list, it doesn't do the same, though:

numlist

Type text and markdown throws error in same blueprint

The error The field type "text" does not exist is thrown when using type: text and type: markdown on the same blueprint. Can you reproduce?

The following blueprint won't work:

preset: page
pages: false

fields:
  intro:
    label: Intro
    type: text

  text:
    label: Text
    type: markdown

Add toolbar and basic shortcuts

Start by adding the exact same as the textarea field:

1. Toolbar

  • headlines
    • H1
    • H2
    • H3
  • bold
  • italic
  • link
  • email
  • code
  • ul
  • ol

2. Shortcuts

  • Bold (Cmd + b)
  • Italic (Cmd + i)
  • Link (Cmd + l)
  • Email (Cmd + e)

Registration of custom buttons

It would be great to be able to easily add custom buttons. The current issue is the order in which components are loaded.

Currently, each button (eg. bold) will look for a corresponding k-mardown-button-bold component, which contains a bunch of things:

  • Its template (which only the headlines button overrides)
  • Some data:
data() {
  return {
    label: 'My label', // Shown on hover
    icon: 'my-icon', // Displayed in the toolbar
    type: 'my-button-type', // Used to identify whether the current selection is within the associated token type
    shortcut: 'Cmd-B', // Shortcut that should trigger the action (optional)
  }
}
  • An action method, triggered on click or shortcut:
methods: {
  action() {
    alert('It works!')
  }
}

All buttons extend a base button (button.vue).

So, in theory, one could create custom buttons by registering a component in another plugin, with as little config as:

panel.plugin('my/methods', {
  components: {
    'k-markdown-button-test': {
      extends: 'k-markdown-button',
      data: function() {
        return {
          label: 'My label',
          icon: 'my-icon',
        }
      },
      methods: {
        action() {
          alert('It works!')
        }
      }
    },
  },
});

And then in a blueprint:

mymarkdownfield:
  type: markdown
  buttons:
    - test

The issue is: how could we set it up so that k-markdown-button is available to extend by the time k-markdown-button-test tries to?

Error if I choose no picture, but confirm

An error accours, if i click on image button in editor, select no image but confirm with okay.

screencast 2019-01-24 07-50-53

kirby-markdown-field: latest(f62b775), but also in other older versions
Kirby 3.0.0
Max OSX, Chrome latest 70.x

fatal error if kirby is installed in a custom directory

If you install Kirby in a custom directory (https://getkirby.com/docs/cookbook/installation/composer#installing-kirby-to-a-custom-directory), the plugin throws this error:
Warning: require(/var/www/htdocs/vendor/k-community/markdown-field/lib/fields/../../../../../kirby/config/fields/textarea.php): failed to open stream: No such file or directory in /var/www/htdocs/vendor/k-community/markdown-field/lib/fields/markdown.php on line 5

The path is falsely defined hard:
https://github.com/sylvainjule/kirby-markdown-field/blob/fe3d9df124668297422a9247d45fca8c308872c4/lib/fields/markdown.php#L5

Long HTML tags explode writing area width

I am using the pages preset with the bigger one (⅔ ratio) using a type: markdown field. No custom plugin configuration. I guess there's nothing else to say. 🙂

grafik

Prepare autocomplete API for editor

Make CodeMirror aware of Kirbytags and implement an basic autocomplete feature, that will allow us to define simple rulesets for all built-in Kirbytags. This should be made available for user-generated Kirbytags later on.

Fine-tune headlines option

Allow dev to either register the whole headlines dropdown:

buttons:
  - headlines

Or limit the displayed headlines (would still be grouped under the headlines dropdown):

buttons:
  - headlines
    - h2
    - h3

Long content glitch

Sometimes when I paste long content with a lot of formatting the upper half gets hidden. When triggering a rewrite via a click or browser resize, it gets fixed. Tested in latest Chrome, Firefox and Safari.

I have not yet found the exact length or formatting amount to reproduce it. You can find an example text on the bottom of this issue, though.

markdown

## Lorem Ipsum 

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.aaa

**Lorem Ipsum:**

- 2009: Finalistin beim internationalen Wettbewerb „Schömberger Fotoherbst für Reise- und Reportagefotografie“ mit ihrer Dokumentation der Arbeit der „Helfenden Hände e.V.“ in Nouakchott / Mauretanien. 
- Im September 2009 erstmalige Teilnahme an den IPA int ́l photography awards in New York; Ulrike Klumpps Arbeiten erreichten die Endrunde und damit ein „Honorable Mention“. 
- Diesen Erfolg konnte sie in den Folgejahren 2010 – 2015 wiederholen.
- Im Juli 2010 war ihr Projekt “SchwarzwaldMenschen” eines der vier Besten des Berliner Wettbewerbs “Halbtagsjob 2010”.
- 2011: Finalistin beim 11. „Schömberger Fotoherbst “ mit der Geschichte „Farm Glenorkie“.
- September 2011: 2. Platz der IPA New York, Kategorie Architektur / Stadtlandschaften.
- 2015: Finalistin beim 13. „Schömberger Fotoherbst“, Serie „Waisenhaus in Burundi“.

**Lorem Ipsum:**

- Ausstellung „Naturreine Interpretationen“ in der Kreissparkasse Freudenstadt, August 2007.
- Ausstellung „Anders sehen – anderes Sehen“ in Dornstetten, Frühjahr 2009. Die Serie entstand aus der ehrenamtlichen Dokumentation der Arbeit der „Helfenden Hände e.V.“ in Nouakchott/Mauretanien.
- Gruppenausstellung „Farbe in der Natur“ im Palmengarten Frankfurt, Oktober 2009.
- Teilnahme an der Internationalen Kalenderschau des Graphischen Klubs Stuttgart und am Calendar Fair der Japan Federation of Printing Industries mit einer Auftragsarbeit für die HOMAG Holzbearbeitungssysteme AG. Januar 2010.
- Ausstellung „ 7969 km Schwarzwald – Namibia“ in der Kulturfabrik in Schopfheim, 2012/13.
- Im Oktober 2013 eröffnete Ulrike Klumpp ihre eigene Fotogalerie in Baiersbronn. Neben ihren eigenen Fotoprojekten bietet die Galerie auch Raum, Ausstellungen anderer Fotokünstler zu präsentieren.
- Gemeinschaftsausstellung „Heimischer Hirsch“ – Kunstausstellung mit zeitgenössischer Malerei und Fotografie, Galerie U in Baiersbronn, ab April 2015.
- Ausstellung „Kaffee – Menschen – Kunst“ über das Kaffeeland Guatemala im Neuen Rathaus Altensteig, Juli – September 2016.
- Ausstellung „ Naturreine Interpretationen“ in Berlin Sommer 2017 zur IGA 2017
- Ausstellung „Olifant“ im Rathaus Freudenstadt Sommer/Herbst 2017
- Ausstellung WÄLDER im Haus des Waldes in Stuttgart
- Ausstellung Menschen in Burundi in Berlin 2018-12-13

**Lorem Ipsum**

Buch „WÄLDER in Baden Württemberg“ zusammen mit Forst BW 2017
Silberburg Verlag, Tübingen ISBN 978-3-8425-2038-7

[Bug] 'Image' and 'File' Buttons Fail on Top Level of Panel

The image and file buttons work fine inside a Page - e.g., the Home Page. But if the field is placed somewhere at the top level of the panel - ie., when the field is being used inside the 'site.yml' blueprint - then these buttons don't work, and the user gets an error message:

screen shot 2019-01-12 at 11 28 12 am

I guess the queries that are being used are page.images and page.files. When we're trying to get images and files at the top-level, outside any pages, I guess they have to be site.images and site.files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.