Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional markdown editor options #10

Closed
wants to merge 8 commits into from

Conversation

Veriael
Copy link

@Veriael Veriael commented Sep 19, 2019

Adds options:

  • underline,
  • strikethrough,
  • center.

Needs additional flarum-markdown.yml translations:

      underline_tooltip: Add underlined text
      strikethrough_tooltip: Add strikethrough text
      center_tooltip: Add centered text

@matteocontrini
Copy link
Contributor

[u] and [center] are not markdown, and this is an extension for markdown

@Veriael
Copy link
Author

Veriael commented Sep 19, 2019

[u] and [center] are not markdown, and this is an extension for markdown

Well, you're right. I missed this options though, I believe some others did too. It may stay as optional fork, I don't really care about that. Jordanjay asked me to, so I did requested this pull.

@matteocontrini
Copy link
Contributor

Maybe this could be an extension? I think it's possible to add buttons from a third party extension

@Veriael
Copy link
Author

Veriael commented Sep 19, 2019

I think it even should be. That's kinda weird, that you can edit text using graphic menu with exception of like... three options? The other way for it is that It could be named "Markdown+" or something like that, and have just option to enable additional BBCode formatting.

@dsevillamartin
Copy link
Member

See https://github.com/flarum/core/issues/1872 @Veriael. In the future, we'll want to make the markdown bar be a normal editor toolbar that is implemented in core, so forums don't need Markdown installed to use it.

You should be able to add elements to it through extensions though, it's just not obvious. You'd have to change the vdom of the ItemList element... but there's definitely a way.

Copy link
Contributor

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

As @matteocontrini mentioned, a couple small changes are necessary.

Also, please do not commit changes to the files in js/dist. These will be compiled automatically once we merge to master.

<MarkdownButton title={tooltip('quote')} icon="fas fa-quote-left" style={{ prefix: '> ', multiline: true, surroundWithNewlines: true }} />
<MarkdownButton title={tooltip('code')} icon="fas fa-code" style={{ prefix: '`', suffix: '`', blockPrefix: '```', blockSuffix: '```' }} />
<MarkdownButton title={tooltip('link')} icon="fas fa-link" style={{ prefix: '[', suffix: '](url)', replaceNext: 'url', scanFor: 'https?://' }} />
<MarkdownButton title={tooltip('image')} icon="fas fa-image" style={{ prefix: '![', suffix: '](src)', replaceNext: 'src', scanFor: 'https?://' }} />
<MarkdownButton title={tooltip('center')} icon="fas fa-align-center" style={{ prefix: '[center]', suffix: '[/center]', trimFirst: true }} hotkey="c" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extension only configures the Litedown bundle, which is a simple Markdown flavor.

Therefore, we should not add buttons for BBCode-specific functionality here. If anything, that would belong in our bbcode extension - however, that would first require moving the button toolbar to core, so that it can be used from other extensions as well. That is something that will take us a while to figure out, so let's focus on the Markdown part for now.

@BigMinnie
Copy link

Spoilers addition with || text || as in discord would be also great to add.

Copy link
Sponsor Member

@askvortsov1 askvortsov1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! I agree with the requested changes from Franz and David. @Veriael, please feel free to update with those changes if you're still interested.

@askvortsov1
Copy link
Sponsor Member

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants