Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Support Multiline Indentation on Chrome and Safari #3

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

StevenEWright
Copy link
Owner

@StevenEWright StevenEWright commented Aug 1, 2023

Originally from: antonmedv#100

This PR partially addresses antonmedv#97 by providing opt-in support for multiline indentation in non-Firefox browsers.

By default, the current behavior (and codepaths) are the same as before. To opt-in to the new feature, users must enable a new option (multilineIndentation), as demonstrated in the updated Index.html

  const jar = CodeJar(editor, withLineNumbers(highlight), {multilineIndentation: true, tab: '  '})

I believe it would be possible to support Firefox, and I'm happy to collaborate with someone on this PR if they'd like to see support added for that initially.

@StevenEWright StevenEWright merged commit 13c3d4e into master Aug 1, 2023
@StevenEWright StevenEWright deleted the swright/multiline branch August 1, 2023 14:29
@ben519
Copy link

ben519 commented Aug 1, 2023

Impeccable timing. I just came looking for this feature!

@StevenEWright
Copy link
Owner Author

@ben519 I am working on a project where this component is a key feature. I hope to be doing a lot of work on this over time. If you have any thoughts / comments / etc, I'd love to hear.

@ben519
Copy link

ben519 commented Aug 1, 2023

I'm also working on a project where I would love a few small additional features to CodeJar. I may be willing to sponsor some of your work if it's going to get merged into the main project.

@StevenEWright
Copy link
Owner Author

@ben519 No need to sponsor :) But that's a generous thought.

I don't think this work will ever be merged into the main project. My impression is that the main branch is keen to maintain a pretty minimalist set of features. For example, the maintainer pulled first party support for line numbers, has been pulling support for auto-close-brackets, doesn't seem keen to facilitate getting multi-line indentation-with-tab in, doesn't want to support no-wrap, etc.

I can understand the desire for a bare-bones editor, and I see value in that - and I can understand wanting to extern things like line numbers by supporting some composable design - but, in general, I don't think he's going to support sufficient composability to achieve all of the features I need in purely composable ways - and I have an interest in going quite a bit further - by, for example, recycling dom elements while scrolling so that my users don't have problems when they try to delete/cut 100s of lines of text.

So, yeah, my plan is to maintain a branch that pulls in useful features from upstream where it can, but otherwise steams along on its own more full-featured path.

@ben519
Copy link

ben519 commented Aug 2, 2023

Gotcha. Well, I commend your effort. I'm all about keeping things light, simple, and bug free. Just to give you an idea of what I'm looking for...

  1. Everything that comes with a basic text editor should just work. I.e. copy, paste, undo, redo, tab indent (including when a block of text is highlighted), etc.
  2. Auto-closing of quotes, brackets, parentheses, etc. is great, but I wish I could choose which characters had this feature. It's annoying when single quotes get "auto closed" because I mostly use them for english contractions like "the dog's bowl".
  3. The more I play with CodeJar, the more I realize how important auto-indentation is to my normal coding experience. If you could nail this, that'd be wonderful.

I think I need to mess around with Monaco Editor and CodeMirror. They seem way more bloated than what I need, but the support behind them is a major benefit.

@StevenEWright
Copy link
Owner Author

Don't forget Ace.

I evaluated all of them for myself but RTL support is critical for me and I didn't feel it was a sufficient priority for any of those. Even if i was willing to figure out their codebases to contribute I didn't feel it was something they would care enough about preventing from breaking. To wit i believe codemirror supported it in an old version but no longer? I forget.

@StevenEWright
Copy link
Owner Author

@ben519 Please see: @kullna/editor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants