New editor
#458
Zusammengeführt
elegaanz
hat 13 Commits von editor
nach master
vor 5 Jahren zusammengeführt
Reviewer
Überprüfung anfordern
Keine Reviewer
Label
Label entfernen
Related to the REST API
Code running on the server
Stuff related to Federation
Related to the front-end
Translations, and related code
More about project management or code than the project itself
The building, or installation process of Plume
Something isn't working
We need to talk
New feature or request
This is a new feature
Compatibility with different browsers, readers and OS
Related to an external package that Plume uses
UI/UX related issues and PRs
Good for newcomers
Extra attention is needed
Issues affecting only mobile UX
How elements're rendered out for the end user
Something else needs to be fixed first
This issue or pull request already exists
This PR is not complete yet
Issues concern a limited number of instances
This doesn't seem right
Need to be discussed by the community (on Loomio)
This PR is ready to be reviewed
Proposed ideas worth considering
This is issue has been created after a vote on Loomio
This will not be worked on
Label anwenden
A: API
Related to the REST API
A: Backend
Code running on the server
A: Federation
Stuff related to Federation
A: Front-End
Related to the front-end
A: I18N
Translations, and related code
A: Meta
More about project management or code than the project itself
A: Security
Build
The building, or installation process of Plume
C: Bug
Something isn't working
C: Discussion
We need to talk
C: Enhancement
New feature or request
C: Feature
This is a new feature
Compatibility
Compatibility with different browsers, readers and OS
Dependency
Related to an external package that Plume uses
Design
UI/UX related issues and PRs
Documentation
Good first issue
Good for newcomers
Help welcome
Extra attention is needed
Mobile
Issues affecting only mobile UX
Rendering
How elements're rendered out for the end user
S: Blocked
Something else needs to be fixed first
S: Duplicate
This issue or pull request already exists
S: Incomplete
This PR is not complete yet
S: Instance specific
Issues concern a limited number of instances
S: Invalid
This doesn't seem right
S: Needs Voting/Discussion
Need to be discussed by the community (on Loomio)
S: Ready for review
This PR is ready to be reviewed
Suggestion
Proposed ideas worth considering
S: Voted on Loomio
This is issue has been created after a vote on Loomio
S: Wontfix
This will not be worked on
Kein Label
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
Meilenstein
Meilenstein setzen
Meilenstein entfernen
Keine Einträge
Kein Meilenstein
Zuständig
Benutzer zuweisen
Zuständige entfernen
Niemand zuständig
2 Beteiligte
Nachrichten
Fällig am
Das Fälligkeitsdatum ist ungültig oder außerhalb des zulässigen Bereichs. Bitte verwende das Format „jjjj-mm-tt“.
Kein Fälligkeitsdatum gesetzt.
Abhängigkeiten
Keine Abhängigkeiten gesetzt.
Referenz: Plume/Plume#458
In neuem Issue referenzieren
Hier gibt es bis jetzt noch keinen Inhalt.
Branch „editor“ löschen
Das Löschen eines Branches ist permanent. Es KANN NICHT rückgängig gemacht werden. Fortfahren?
Abbrechen
Ja
With this PR, when JS is activated and WASM supported, the article editor will be dynamically replaced with
contenteditable
s elements. This makes the editing interface simpler and less like a regular form. It will also allow us to easily add visual formatting with native browser APIs (and to insert images or videos directly). Here is a little demo:There is still a lot to do, but it is a good first step.
Fixes #255
Codecov Report
Something I just noticed: published articles are always drafts (unless you are editing an already published article)
I'm having trouble making it work. I had to tinker plume-front.js. Any idea why, or how to prevent that?
Was the build script correctly run by cargo? Like, did you saw
plume(build)
beforeplume(bin)
next to the compilation progress bar? Otherwise, you can try to add aprintln!("cargo:rerun-if-changed=target/deploy/plume-front.js")
(IIRC) to it, so that we are sure it is re-run when the JS changes (it does when the WASM changes normally, but maybe that's not enough).ok my bad, I ran
cargo web deploy -o ../static
so the buildscript did not update the js file as it should haveBy doing the following change, I was able to copy past a picture in a post and have it rendered as expected. However when re-editing the article,
<
and>
where escaped, leading to a messy html tag in the middle of the content. I don't know if this is considered in scope for this pr, but this might be something to look at, as it will get important once the editor get richershould this file (and fr.po~) exists?
my suggestion to @BaptisteGelez is to either add this our
.gitignore
or to her global.git/ignore
No, I though
*.po~
was in the gitignore, but it looks like it is not. 🤷♀️ I will add it.I think it would be easy to avoid escaping here, I will try.
They are only ignored in some directories, not everywhere
I added back the character counter, but it is not as precise as the previous one, since I only took the article content in account (otherwise I would have had to rebuild all the original form every time, which would be quite long both in code and when running). I don't think that's a big issue, since the previous one was not perfectly precise neither, and that people will rarely reach this limit anyway.
mostly code-style comment again
this line is duplicated
this closure is really long. It would gain in readability to be divided in multiple smaller functions called one after an other (like "hide non-js form", "add js editor", "show popup", "copy editor to form"...). I understand what it's doing, but if there is something wrong, it's too complex to see it right away
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
I love that it just works like in the back-end, with nothing more to
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
Yeah, that's really great! The only downside is that we include all the translations in the .wasm so it is a bit bigger, but there is like 3 or 4 messages for the moment so I guess it's fine (and I don't expect it to become much bigger, I think we will never have more than 30 messages for the front end).
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
considering all Plume translations (not plume-front) are 208k on my computer, any picture loaded on the front page must cost much more than having all translations available
I tried to make the code a bit more readable, but I'm not sure it is enough…
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
so how big is the dynamic front-end right now? and how much of that is cachable?
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
It is 2.2M on my computer, but there are various ways to optimize WASM size that we didn't explored yet. And I don't know how much of it is cachable? Nothing?
@ -6,0 +20,4 @@
lazy_static! {
static ref CATALOG: gettext::Catalog = {
let catalogs = include_i18n!();
let lang = js!{ return navigator.language }.into_string().unwrap();
I'd say everything, it's a static file after all. I tried compiling with
cargo web deploy --release
, it seems to work, and is "only" 832k. We could also try to compact plume-front.js as it's 35k with indentation and things, however I'm not sure it's that important👍
Oups, 2 little things : It doesn't seems to be possible to add carriage return in the content (prevent default I guess), and it may be nice to have a button to switch back to the plain markdown editor
Reviewer
9076dbaadc
gemergt.Schritt 1:
Wechsle auf einen neuen Branch in deinem lokalen Repository und teste die Änderungen.Schritt 2:
Führe die Änderungen zusammen und aktualisiere den Stand online auf Forgejo.