Giter Club home page Giter Club logo

triptrap's People

Contributors

bastianallgeier avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rasteiner

triptrap's Issues

[Idea] Heading offsets

This field is likely to be used for stuff like blog posts. There, you'd want to have one <h1> (which is the title field) and perhaps a subtitle (which might be a subtitle field). This is just good SEO and is how Medium works. This means that in your content, you'll mainly have <h3> and up (again, how Medium works as well). This is also an argument for #8.

My argument is that in the editor, you'll likely be writing ### and #### most of the time, which can get annoying. My proposal is to be able to configure a "heading offset" that specifies the starting heading index.

For example, the default heading offset could be 0, which means:

  • # == <h1>
  • ## == <h2>
  • and so on...

However, if you set headingOffset: 2, you get:

  • # == <h3>
  • ## == <h4>
  • and so on...

This is useful for two reasons:

  1. You get a better writing experience since you won't be counting hash symbols.
  2. If at some point you wish to change the heading hierarchy, you just change the heading offset. For example, if I had headingOffset set to 2 and I want all <h3> to turn into <h2> (and all others to be adjusted accordingly), I would simply reduce headingOffset by 1. I wouldn't have to change the content at all.

Safari Spellchecking Disabled While Typing

In Safari 12.1.1 (14607.2.6.1.1), spellcheck doesn't occur while typing in the field. I would expect to see red underlines for incorrect words. The standard textarea field works fine for this.

Screen Shot 2019-06-20 at 10 06 13 AM

Support all heading tags

Currently, the editor supports just <h1>-<h3>. You can't output the smaller tags even by writing ####, so this is not a just problem with the UI. It should support all six tags so content can be organized more freely.

KirbyTags are wrapped in <p> tags

If I have the following content:

Sample text: (image: quote.png caption: Caption lorem ipsum dolor sit amet)

...I get the following markup:

<p>Sample text: (image: quote.png caption: Caption lorem ipsum dolor sit amet)</p>

That's expected. But when the text is parsed with kirbytext(), the created <figure> tag is put within the <p> tag, which is not valid.

The obvious solution is to save it like that:

Sample text:
(image: quote.png caption: Caption lorem ipsum dolor sit amet)

...which turns into:

<p>Sample text:</p>
<p>(image: quote.png caption: Caption lorem ipsum dolor sit amet)</p>

...and you have the same problem. I don't know how this may be solved efficiently, though. I guess:

  • Kirbytags can be turned into ProseMirror nodes, as I mentioned in #2, which is the best approach, but involves more work
  • The final HTML could be parsed and <p> tags that surround kirbytags should be removed, which I don't think is easily possible and is actually a pretty bad idea, so it's not really a solution

The reason this is such a problem is because the browser can't handle block elements inside a <p> tag since the HTML spec does not allow it. Because of that, markup like:

<p>foo <div>bar</div> baz</p>

...is turned by the browser into:

<p>foo </p><div>bar</div> baz<p></p>

...which is bad. You expect one <p> tag and you get two, one of which is empty.

[Idea] KirbyTags support

You could add kirbytag support by serializing tags to XML before saving them.

(image: quote.png caption: Caption lorem ipsum dolor sit amet)

to

<kirby image="quote.png" caption="Caption lorem ipsum dolor sit amet"/>

I use that in kirby-exporter and it has worked flawlessly so far. It uses a lot of native Kirby functionality too.

Then, you could configure tiptap's toDOM() method to parse <kriby> tags. You'd have a custom Vue component to handle them - and that's it.

As for the UI, you could add a dropdown similar to those for headings - except it contains all possible kirbytags. Or perhaps those that are allowed in the field's blueprint.

Edit: On second thoughts, tiptap should be able to save Kirbytags as XML tags by itself, as long as you correctly define the parse rules. Then, the only problem would be to convert those tags from XML to the actual HTML output that each tag has in a template. That could be accomplished by:

  1. Parse the field's HTML containing XML kirbytags
  2. After obtaining each tag's properties, generate its output
  3. Replace the initial XML tag with the generated markup
  4. Return the processed field HTML

It only saves HTML - Kirbytext better

this is solved?

  • JSON to kirbytext: converted on server
  • kirbytext to JSON: is this necessary or are you passing it generated html or something else?

Bundler is including vue runtime

Like you said on slack, parcel is including the vue runtime in the bundle. Actually, it seems like parcel has no other choice.

tiptap explicitly imports Vue here: https://github.com/scrumpy/tiptap/blob/master/packages/tiptap/src/Utils/ComponentView.js

I see 4 options and none of them is without drawbacks:

  1. We nag ( πŸ˜‰ ) @scrumpy until he removes the dependency: Vue is imported only in that file, maybe there's a workaround
  2. We do nothing: out of the 397KB bundle, the vue runtime is 97KB: "only" about 25%
  3. The editor becomes a core feature (this would still add like 300KB to the panel)
  4. Theoretically, parcel could "alias" the "vue" module to any js file. That js file could be something like
    export default panel.Vue;
    (this requires Kirby's Vue instance to be exposed ofc)

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.