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

Make Magic Editor easily / user-extendible? #143

Open
iBug opened this issue Dec 2, 2018 · 5 comments
Open

Make Magic Editor easily / user-extendible? #143

iBug opened this issue Dec 2, 2018 · 5 comments

Comments

@iBug
Copy link

iBug commented Dec 2, 2018

I took a brief look at Magic Editor's code and found that it's based on a truckload of regexes.

I use that on Android Enthusiasts frequently, but one thing I'm having is that those regexes don't cover WhatsApp, which comes rather often on AE.

While it's possible that I just add a regex for that specific one, I would also like it if it's easily extendible, without modifying existing code. For example, SE AutoComments provides a way to customize the predefined comments via an arbitrary URL to a JSONP file and loads comments from there. Is it possible to have Magic Editor load extra regexes (and replacements) from user-specified external sources? Or in any other way user-extendible?

@makyen
Copy link
Contributor

makyen commented Dec 2, 2018

I've been thinking about adding user-expandability wrt. the substitutions from some time. My opinion is that it would be beneficial. I have not previously considered loading additional substitution rules from a supplied URL, but I can see that it might be useful.

As to WhatsApp, I've added to my version of the development branch, so it will be in the next version. Frankly, I thought it was already in there.

@Tiny-Giant
Copy link
Contributor

Me and Mogsdad did discuss this when we we're originally developing the script, but we dropped it when we realized that you can't store functions in JSON.

@iBug
Copy link
Author

iBug commented Dec 8, 2018

@Tiny-Giant What if the addition is only regex/replacement pairs, with no functions involved? I think regex can be stored as text and later processed so this shouldn't be a problem (I'm no JavaScript guy so IDK).

@makyen
Copy link
Contributor

makyen commented Dec 8, 2018

There appears to be two different goals here:

  1. Simple additions by users to support their own chosen substitutions.
  2. Fully specifiable substitutions, including everything that's currently possible in the App.edits Object. In other words, everything needed to offload everything in App.edits into some external data structure.

I must admit that I'd been assuming just regex/replacement string pairs. While it would be possible to support functions, that would be more complex and have significant security concerns.

I think that we're getting way ahead of ourselves to be thinking of offloading all of App.edits.

@Tiny-Giant
Copy link
Contributor

Tiny-Giant commented Dec 8, 2018

Definitely, if it were limited to just regular expressions and plain substitutions, that would be much simpler and completely possible with JSON. I was just commenting as to the problem we ran in to when we were discussing this topic originally that caused us to table the issue at that time.

We had wanted to move the App.edits object to a separate file so that it could be updated independently of the business logic, and reduce the amount of scrolling necessary to get any work done. I agree that doing so would be beyond the scope of this request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants