[dreamwidth/dw-free] b466f0: Beta create entries page: Improve/update previews
Branch: refs/heads/master
Home: https://github.com/dreamwidth/dw-free
Commit: b466f046d6e814ecbeb7cb1215b0d16569b7de7d
https://github.com/dreamwidth/dw-free/commit/b466f046d6e814ecbeb7cb1215b0d16569b7de7d
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M cgi-bin/LJ/Entry.pm
M views/entry/preview.tt
Log Message:
-----------
Beta create entries page: Improve/update previews
The preview feature of beta create entries was starting to rot, slightly:
- Wasn't loading CSS and JS that journal content expects to have available,
which made things like image shrinking act wrong. Fix: call the same function
that journal pages use to require resources, and use the same res_includes
behavior for the S2 view.
- Template for site skin entry pages was outdated (maybe predated the effort to
move site-skin comments into S2). Fix: update the template. Long-term, it would
be better to figure out how to invoke the siteviews layout from a non-journal
context and just use that (see also: comment previews). But that seemed like a
rabbit hole, and I just needed this out of my way.
Commit: 8855b29935861cebd3ce0a07904a9aecd7b469fa
https://github.com/dreamwidth/dw-free/commit/8855b29935861cebd3ce0a07904a9aecd7b469fa
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
M cgi-bin/LJ/Event/NewUserpic.pm
M cgi-bin/LJ/Feed.pm
M cgi-bin/LJ/Poll.pm
M cgi-bin/LJ/S2/IconsPage.pm
M t/cleaner-event.t
M t/cleaner-markdown.t
Log Message:
-----------
LJ::CleanHTML (and callers) - Minor cleanups
- Stop adding `` tags to long words, this is *extremely* silly. Just use
word-wrap/overflow-wrap in CSS.
- Don't create a new hashref on every call to update_tag
- Remove unused 'linkify' option from some calls
Commit: 4845d9f19aa695b9757b768a7504ce50697fe980
https://github.com/dreamwidth/dw-free/commit/4845d9f19aa695b9757b768a7504ce50697fe980
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
A cgi-bin/DW/Formats.pm
A t/formats.t
Log Message:
-----------
DW::Formats - New helper package for markup formats
This new package isn't used by anything yet, but it sort of serves as a map for
the following commits.
The goal of the coming changes is to introduce *named markup formats* on DW.
We'll use these formats whenever we need to display user-entered body text,
and we'll preserve the format name alongside the source as a permanent record of
how the user expected their markup to be interpreted when they wrote it. This
will give us the freedom to update and change our formatting behaviors as
needed, without vandalizing millions of historical posts or requiring
world-ending database migrations to update old formatting.
STORAGE: Entries and comments both already include an `editor` prop, which will
store the format ID for a given post. Other kinds of body content might be
handled differently as we expand format support. (For example, user bios are
singletons, so their format might be stored as a userprop.) Additionally, we'll
save a user's preferred format for a given content type and use it as the
default in editing UIs.
VERSIONING: Formats are versioned, and any significant change to markup behavior
is now expected to result in a new format name. To keep things manageable,
editing UIs will only offer a limited number of "active" formats at any given
time. (Exception: when editing old content, its current format will be available
in the UI even if it's obsolete.)
USAGE: We'll be using named formats in two ways:
- DISPLAY: Formats will determine the behavior of the HTML cleaner when
preparing content for display. They can affect the behavior of things like line
breaks, special non-standard HTML tags, `
mentions`, and more.
- UI: The currently selected format within an editing UI can potentially affect
its behavior and layout. (Whether to initialize or deinitialize the rich text
editor, whether plain-text editing buttons should emit HTML or Markdown, etc.)
The initial set of formats is a codification of the formats DW **already uses,**
which are currently selected by emergent interactions between the
`opt_preformatted` prop, the imported/syndicated status, Secret Glyphs
(`!markdown`), and the editor prop (currently only used in emailed comments).
Commit: b2721e27faca1a68b59b1f71305c336afdd1ba34
https://github.com/dreamwidth/dw-free/commit/b2721e27faca1a68b59b1f71305c336afdd1ba34
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
Log Message:
-----------
LJ::CleanHTML::clean - Add `nodwtags` option (for `html_extra_raw`)
This new option allows the cleaner to skip processing for all special-sauce
DW/LJ tags, like `[Unknown site tag]` and ``.
This is more about symmetry and coherence than it is about fixing real problems!
As far as I know, we've never encountered syndicated (or otherwise external)
content using custom HTML elements whose names overlap with our magic tags. But
it seems to me we all implicitly _expect_ this behavior, so I'd expect codifying
it will do no harm (and might have some small, unpredictable future benefit).
Commit: 66e75555d032ca1199bc94a11c1a86e1ab99345a
https://github.com/dreamwidth/dw-free/commit/66e75555d032ca1199bc94a11c1a86e1ab99345a
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
Log Message:
-----------
LJ::CleanHTML::clean - Rename `$local_content` to `$at_mentions`
...Since that's the only thing it governs. My theory here is that `clean()`'s
arguments should all control concrete transformation behaviors, and the wrapper
functions around `clean()` should handle the translation from human intent to
specific transformations. "Local content" is a social distinction, so it's a
concern for the wrappers.
Commit: 8c601850e5839ad26189ca3a4fcc72f6431a585e
https://github.com/dreamwidth/dw-free/commit/8c601850e5839ad26189ca3a4fcc72f6431a585e
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
M t/cleaner-markdown.t
Log Message:
-----------
LJ::CleanHTML::clean_event/clean_comment - use named formats
- Add a utility function for translating a named markup format to a specific
set of arguments that can be passed to `clean()`. Yeah, it's kind of frustrating
that this isn't in DW::Formats, but keeping the chaos of `clean()` contained to
one file seemed more important.
- Updates clean_event and clean_comment to use named formats from their `editor`
argument if available, and to guess an appropriate format otherwise. The
guessing behavior mostly uses the same heuristics we were already using to
switch off between the cleaner's options, and so it mostly results in the same
behavior as before this patch.
- EXCEPT for two new behaviors: Native site content written before May of 2019
now skips converting `
mentions`, and syndicated content now uses the "extra
raw" version of preformatted HTML. (Though we're not passing in the posting date
yet, so that behavior won't ever fire.)
Commit: 2921ad72d1cb51da49b017f156d45553c8d2365f
https://github.com/dreamwidth/dw-free/commit/2921ad72d1cb51da49b017f156d45553c8d2365f
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/CutExpander.pm
M cgi-bin/LJ/Comment.pm
M cgi-bin/LJ/Entry.pm
M cgi-bin/LJ/S2.pm
M cgi-bin/LJ/S2/EntryPage.pm
M cgi-bin/LJ/S2/ReplyPage.pm
Log Message:
-----------
Pass extra info to clean_event and clean_comment
This updates various callers of clean_event and clean_comment to pass in the
extra info we use to guess the format of old content.
Also, in S2: stop passing a bunch of stuff that LJ::Entry::event_html just
overrides with the same value anyway. (Detritus from a previous code path that
reimplemented event_html by hand.)
Commit: 331d9e84fab86ea07436de4a822231825954da7b
https://github.com/dreamwidth/dw-free/commit/331d9e84fab86ea07436de4a822231825954da7b
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/proplists.dat
Log Message:
-----------
NEW USERPROPS: comment_editor and entry_editor2
These userprops are for tracking the user's preferred markup format. Separate
props for entries and comments, just in case that ends up being important.
Using a new prop for entry in order to not stomp on the existing prop for the
old RTE.
Commit: 957d366ecb003053e4a6f09e513fe5b9e01f81b1
https://github.com/dreamwidth/dw-free/commit/957d366ecb003053e4a6f09e513fe5b9e01f81b1
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/Global/Img.pm
Log Message:
-----------
Fix reported height/width of Silk help icon
These silk icons don't need any additional help at being tiny and blurry.
Commit: e92a926e2f0a15b5327ada1a07928e5976417a24
https://github.com/dreamwidth/dw-free/commit/e92a926e2f0a15b5327ada1a07928e5976417a24
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/deadphrases.dat
M bin/upgrading/en.dat
M cgi-bin/LJ/Talk.pm
M cgi-bin/LJ/Web.pm
M htdocs/scss/components/quick-reply.scss
M views/journal/quickreply.tt
M views/journal/talkform.tt
M views/journal/talkform.tt.text
Log Message:
-----------
Talkform and quick-reply: Add formats dropdown (PROD STRING UPDATE)
This adds a formatting dropdown to the reply forms, replacing the old "don't
autoformat" checkbox.
- The dropdown goes between the subject and body fields, and the quote button
moves alongside it to provide some visual balance.
- The dropdown sets a value for the `prop_editor` form field. (Currently unused,
but matching the naming convention of the other property-tied comment form
fields like `prop_opt_preformatted` and `prop_picture_keyword`.)
- The available values and default selected value are deferred to DW::Formats.
To help it decide, we tell it:
- The _user-preferred_ format is the comment_editor userprop (currently never
set by anything).
- The _current_ format is whatever was passed in the `prop_editor` field of
the submitted form (not passed for comment edits yet, but it'll already
carry over for "more options", preview, and fixing errors on talkpost_do).
- The help icon is meant to link to a FAQ page all about our formatting options.
On deploy, site owners will need to edit the following strings to make that icon
link to the right place:
- markup.helplink.url
- markup.helplink.alttext
Commit: e772bffa836fadcbde845f514db2004f364e9cd7
https://github.com/dreamwidth/dw-free/commit/e772bffa836fadcbde845f514db2004f364e9cd7
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/Misc.pm
M cgi-bin/DW/Controller/Talk.pm
M cgi-bin/DW/EmailPost/Comment.pm
M cgi-bin/LJ/Comment.pm
M cgi-bin/LJ/Protocol.pm
M cgi-bin/LJ/S2/ReplyPage.pm
M cgi-bin/LJ/Talk.pm
Log Message:
-----------
Comment machinery: Wire prop_editor through everything
Now we're getting somewhere! It goes a little like this, starting at the backend
and moving outwards:
- `edit_comment` and `post/enter_comment` now insert their received
`$comment->{editor}` value into the DB.
- `LJ::Talk::prepare_and_validate_comment` now copies the form's `prop_editor`
value to `$comment->{editor}`
- Comments always pass through either `/talkpost_do` or `LJ::Comment::create`,
both of which now forward `prop_editor` to `prepare_and_validate_comment`.
- Talkform and quick-reply already pass `prop_editor` to `/talkpost_do`.
- `LJ::Protocol::addcomment` now passes `props->{editor}` to
`LJ::Comment::create`.
- `/__rpc_addcomment` (quicker-reply from last-N pages) now forwards
`prop_editor` to Protocol.
- Emailpost now passes `prop_editor` to Protocol.
Also:
- Preview includes the editor value when faking up an unvalidated comment, and
passes the editor value along to `clean_comment` when formatting a WIP comment
for display.
- The comment edit link adds the existing comment's editor to the form values
that get passed to the talkform, so it'll respect the current format.
Commit: 0b7cd2ec2afd2df7f3d7a8c200cbf277a26629e1
https://github.com/dreamwidth/dw-free/commit/0b7cd2ec2afd2df7f3d7a8c200cbf277a26629e1
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M htdocs/scss/pages/entry/new.scss
M views/entry/form.tt
Log Message:
-----------
Beta create entries page: Enable formatting types
This adds an editors dropdown to the beta create entries page, which works
exactly like the one in the comment forms:
- We detect the best-fit editor when editing older content that doesn't have a
value set.
- Preview respects editor value.
- Uses the entry_editor2 userprop for the default format... but as of this
commit, nothing sets that.
Entries: stop auto-setting editor userprop
Commit: 34d694e83c70395759add2c6eb0d59819eada6cd
https://github.com/dreamwidth/dw-free/commit/34d694e83c70395759add2c6eb0d59819eada6cd
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M htdocs/scss/components/quick-reply.scss
M htdocs/scss/pages/entry/new.scss
Log Message:
-----------
Format switcher: Fallback styling for non-flex browsers
Commit: a36b3c7646b4f04808381b918f0925f3f516211d
https://github.com/dreamwidth/dw-free/commit/a36b3c7646b4f04808381b918f0925f3f516211d
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M t/post.t
Log Message:
-----------
Fix/add post tests
Commit: bbfc48c23c131df34255cb11f6c072b9ba5063e4
https://github.com/dreamwidth/dw-free/commit/bbfc48c23c131df34255cb11f6c072b9ba5063e4
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/EmailPost/Base.pm
M cgi-bin/DW/EmailPost/Comment.pm
M cgi-bin/DW/EmailPost/Entry.pm
M htdocs/manage/emailpost.bml
M htdocs/manage/emailpost.bml.text
Log Message:
-----------
Email posts: Enable new `post-format` header, default entries to Markdown
This new header lets you choose which format you want to use for emailed
comments or entries. Since email is sort of halfway between a UI and an API, it
allows two forms of format values:
- Humans typing directly into their mail client should ask for either `html` or
`markdown` (aliases to the current versions of Casual HTML and Markdown), so
they can use what they're familiar with from the web UI.
- Automated integrations (or humans with very particular tastes) should specify
a "real" format ID like `html_casual0`, so they can continue to work predictably
when formats change in the future.
And since there's now a way to opt out of it, emailed entries now default to
Markdown, same as emailed comments.
Commit: 2e011b300813297463b4e256c306ada167b40f61
https://github.com/dreamwidth/dw-free/commit/2e011b300813297463b4e256c306ada167b40f61
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/deadphrases.dat
M cgi-bin/DW/Controller/Entry.pm
M views/entry/success.tt
M views/entry/success.tt.text
Log Message:
-----------
Arrange entry success links in a consistent way
(This has driven me nuts for years.)
Commit: 946b59aa37ca3ea1412b105b15c1bc3ca1b8a704
https://github.com/dreamwidth/dw-free/commit/946b59aa37ca3ea1412b105b15c1bc3ca1b8a704
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/User/Journal.pm
M cgi-bin/LJ/User/Permissions.pm
Log Message:
-----------
Add custom getters/setters for comment_editor and entry_editor2 userprops
This makes it easier to compare things against the user's *effective* default
(e.g. if they never set a default), and lets us silently upgrade outdated
defaults.
Commit: 71e6b84679280848bc1612a3aa9c8fcb3078f640
https://github.com/dreamwidth/dw-free/commit/71e6b84679280848bc1612a3aa9c8fcb3078f640
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
A cgi-bin/DW/Controller/Editor.pm
A views/default_editor.tt
A views/default_editor.tt.text
A views/default_editor_form.tt
Log Message:
-----------
Add controller (and templates) for updating default format userprops
A page that wants to offer the chance to update your default (like comment/entry
success pages) can do so with the default_editor_form.tt template fragment.
To reduce clutter, this is a one-button interface rather than a real
choose-a-value setting. That means it should only be displayed after the user
does something that involved choosing a non-default format, so we know which
format we're offering to switch to.
Commit: a04c4a5332f558d742e41633be7db412f05d4168
https://github.com/dreamwidth/dw-free/commit/a04c4a5332f558d742e41633be7db412f05d4168
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Talk.pm
Log Message:
-----------
Add default format update button to comment success page
If the user posted a comment in an active format that isn't their default, give
them the chance to update their default for next time.
Commit: 79e18031a525d91d90059fa8153257ea828191fd
https://github.com/dreamwidth/dw-free/commit/79e18031a525d91d90059fa8153257ea828191fd
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M htdocs/js/jquery.ajaxtip.js
Log Message:
-----------
Add new "sticky" method to ajaxtip
It already has an "error" method that doesn't auto-dismiss on a timer, but that
still dismisses as soon as you mouse past it. To allow some kind of interaction
with the result of an ajaxtip request, you want the pop-up to stay on the screen
until you click away from it. So this lets it do that.
Commit: 353d5060af287cf60e1d0205be6959ac414d8f81
https://github.com/dreamwidth/dw-free/commit/353d5060af287cf60e1d0205be6959ac414d8f81
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/Misc.pm
M htdocs/js/jquery.quickreply.js
Log Message:
-----------
Add default format update button to quicker-reply success pop-up
The quicker-reply posts via an RPC call instead of talkpost_do, so that you can
stay on your current page. To respect that, we'll show the update button in
the inline success message instead of redirecting to a success page. (This
requires a sticky tooltip.)
Commit: 9a19b3e097a20af2355a514a6d63624612552a70
https://github.com/dreamwidth/dw-free/commit/9a19b3e097a20af2355a514a6d63624612552a70
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/Talk.pm
A htdocs/js/jquery.default-editor.js
M views/default_editor_form.tt
Log Message:
-----------
Add JavaScript for changing default format without leaving the page
A basic little ajax submit script that hits the default_editor RPC endpoint.
The form fragment can bring the JS in automatically if you're building it into a
page from the beginning, but if the form gets added to a page via ajax (like
with the quicker-reply), the page needs to require the script ahead of time.
Commit: 41fd189ad3fb36d2517d77273fa7bc96e2b72b4a
https://github.com/dreamwidth/dw-free/commit/41fd189ad3fb36d2517d77273fa7bc96e2b72b4a
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M views/entry/success.tt
Log Message:
-----------
Add default format update button to entry success page
There's *sort of* an entries equivalent of the quick-reply (it's the update
widget on the home page), but it's married to the old BML create entries form
and so I'm not going to mess with it right now.
Commit: 5f7601511ef5b568b6e3f3a7829ee657c98ce1cb
https://github.com/dreamwidth/dw-free/commit/5f7601511ef5b568b6e3f3a7829ee657c98ce1cb
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M cgi-bin/LJ/User/Journal.pm
Log Message:
-----------
Tidy
Commit: 416748735e7351a11976ae0fcce96ceb130d4ba3
https://github.com/dreamwidth/dw-free/commit/416748735e7351a11976ae0fcce96ceb130d4ba3
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Editor.pm
M views/default_editor.tt.text
Log Message:
-----------
Editors controller: Check for $r->did_post, include v5.10 pragma
Compare: https://github.com/dreamwidth/dw-free/compare/970896476e25...416748735e73
Home: https://github.com/dreamwidth/dw-free
Commit: b466f046d6e814ecbeb7cb1215b0d16569b7de7d
https://github.com/dreamwidth/dw-free/commit/b466f046d6e814ecbeb7cb1215b0d16569b7de7d
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M cgi-bin/LJ/Entry.pm
M views/entry/preview.tt
Log Message:
-----------
Beta create entries page: Improve/update previews
The preview feature of beta create entries was starting to rot, slightly:
- Wasn't loading CSS and JS that journal content expects to have available,
which made things like image shrinking act wrong. Fix: call the same function
that journal pages use to require resources, and use the same res_includes
behavior for the S2 view.
- Template for site skin entry pages was outdated (maybe predated the effort to
move site-skin comments into S2). Fix: update the template. Long-term, it would
be better to figure out how to invoke the siteviews layout from a non-journal
context and just use that (see also: comment previews). But that seemed like a
rabbit hole, and I just needed this out of my way.
Commit: 8855b29935861cebd3ce0a07904a9aecd7b469fa
https://github.com/dreamwidth/dw-free/commit/8855b29935861cebd3ce0a07904a9aecd7b469fa
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
M cgi-bin/LJ/Event/NewUserpic.pm
M cgi-bin/LJ/Feed.pm
M cgi-bin/LJ/Poll.pm
M cgi-bin/LJ/S2/IconsPage.pm
M t/cleaner-event.t
M t/cleaner-markdown.t
Log Message:
-----------
LJ::CleanHTML (and callers) - Minor cleanups
- Stop adding `
word-wrap/overflow-wrap in CSS.
- Don't create a new hashref on every call to update_tag
- Remove unused 'linkify' option from some calls
Commit: 4845d9f19aa695b9757b768a7504ce50697fe980
https://github.com/dreamwidth/dw-free/commit/4845d9f19aa695b9757b768a7504ce50697fe980
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
A cgi-bin/DW/Formats.pm
A t/formats.t
Log Message:
-----------
DW::Formats - New helper package for markup formats
This new package isn't used by anything yet, but it sort of serves as a map for
the following commits.
The goal of the coming changes is to introduce *named markup formats* on DW.
We'll use these formats whenever we need to display user-entered body text,
and we'll preserve the format name alongside the source as a permanent record of
how the user expected their markup to be interpreted when they wrote it. This
will give us the freedom to update and change our formatting behaviors as
needed, without vandalizing millions of historical posts or requiring
world-ending database migrations to update old formatting.
STORAGE: Entries and comments both already include an `editor` prop, which will
store the format ID for a given post. Other kinds of body content might be
handled differently as we expand format support. (For example, user bios are
singletons, so their format might be stored as a userprop.) Additionally, we'll
save a user's preferred format for a given content type and use it as the
default in editing UIs.
VERSIONING: Formats are versioned, and any significant change to markup behavior
is now expected to result in a new format name. To keep things manageable,
editing UIs will only offer a limited number of "active" formats at any given
time. (Exception: when editing old content, its current format will be available
in the UI even if it's obsolete.)
USAGE: We'll be using named formats in two ways:
- DISPLAY: Formats will determine the behavior of the HTML cleaner when
preparing content for display. They can affect the behavior of things like line
breaks, special non-standard HTML tags, `
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
- UI: The currently selected format within an editing UI can potentially affect
its behavior and layout. (Whether to initialize or deinitialize the rich text
editor, whether plain-text editing buttons should emit HTML or Markdown, etc.)
The initial set of formats is a codification of the formats DW **already uses,**
which are currently selected by emergent interactions between the
`opt_preformatted` prop, the imported/syndicated status, Secret Glyphs
(`!markdown`), and the editor prop (currently only used in emailed comments).
Commit: b2721e27faca1a68b59b1f71305c336afdd1ba34
https://github.com/dreamwidth/dw-free/commit/b2721e27faca1a68b59b1f71305c336afdd1ba34
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
Log Message:
-----------
LJ::CleanHTML::clean - Add `nodwtags` option (for `html_extra_raw`)
This new option allows the cleaner to skip processing for all special-sauce
DW/LJ tags, like `[Unknown site tag]` and ``.
This is more about symmetry and coherence than it is about fixing real problems!
As far as I know, we've never encountered syndicated (or otherwise external)
content using custom HTML elements whose names overlap with our magic tags. But
it seems to me we all implicitly _expect_ this behavior, so I'd expect codifying
it will do no harm (and might have some small, unpredictable future benefit).
Commit: 66e75555d032ca1199bc94a11c1a86e1ab99345a
https://github.com/dreamwidth/dw-free/commit/66e75555d032ca1199bc94a11c1a86e1ab99345a
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
Log Message:
-----------
LJ::CleanHTML::clean - Rename `$local_content` to `$at_mentions`
...Since that's the only thing it governs. My theory here is that `clean()`'s
arguments should all control concrete transformation behaviors, and the wrapper
functions around `clean()` should handle the translation from human intent to
specific transformations. "Local content" is a social distinction, so it's a
concern for the wrappers.
Commit: 8c601850e5839ad26189ca3a4fcc72f6431a585e
https://github.com/dreamwidth/dw-free/commit/8c601850e5839ad26189ca3a4fcc72f6431a585e
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/CleanHTML.pm
M t/cleaner-markdown.t
Log Message:
-----------
LJ::CleanHTML::clean_event/clean_comment - use named formats
- Add a utility function for translating a named markup format to a specific
set of arguments that can be passed to `clean()`. Yeah, it's kind of frustrating
that this isn't in DW::Formats, but keeping the chaos of `clean()` contained to
one file seemed more important.
- Updates clean_event and clean_comment to use named formats from their `editor`
argument if available, and to guess an appropriate format otherwise. The
guessing behavior mostly uses the same heuristics we were already using to
switch off between the cleaner's options, and so it mostly results in the same
behavior as before this patch.
- EXCEPT for two new behaviors: Native site content written before May of 2019
now skips converting `
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
raw" version of preformatted HTML. (Though we're not passing in the posting date
yet, so that behavior won't ever fire.)
Commit: 2921ad72d1cb51da49b017f156d45553c8d2365f
https://github.com/dreamwidth/dw-free/commit/2921ad72d1cb51da49b017f156d45553c8d2365f
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/CutExpander.pm
M cgi-bin/LJ/Comment.pm
M cgi-bin/LJ/Entry.pm
M cgi-bin/LJ/S2.pm
M cgi-bin/LJ/S2/EntryPage.pm
M cgi-bin/LJ/S2/ReplyPage.pm
Log Message:
-----------
Pass extra info to clean_event and clean_comment
This updates various callers of clean_event and clean_comment to pass in the
extra info we use to guess the format of old content.
Also, in S2: stop passing a bunch of stuff that LJ::Entry::event_html just
overrides with the same value anyway. (Detritus from a previous code path that
reimplemented event_html by hand.)
Commit: 331d9e84fab86ea07436de4a822231825954da7b
https://github.com/dreamwidth/dw-free/commit/331d9e84fab86ea07436de4a822231825954da7b
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/proplists.dat
Log Message:
-----------
NEW USERPROPS: comment_editor and entry_editor2
These userprops are for tracking the user's preferred markup format. Separate
props for entries and comments, just in case that ends up being important.
Using a new prop for entry in order to not stomp on the existing prop for the
old RTE.
Commit: 957d366ecb003053e4a6f09e513fe5b9e01f81b1
https://github.com/dreamwidth/dw-free/commit/957d366ecb003053e4a6f09e513fe5b9e01f81b1
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/Global/Img.pm
Log Message:
-----------
Fix reported height/width of Silk help icon
These silk icons don't need any additional help at being tiny and blurry.
Commit: e92a926e2f0a15b5327ada1a07928e5976417a24
https://github.com/dreamwidth/dw-free/commit/e92a926e2f0a15b5327ada1a07928e5976417a24
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/deadphrases.dat
M bin/upgrading/en.dat
M cgi-bin/LJ/Talk.pm
M cgi-bin/LJ/Web.pm
M htdocs/scss/components/quick-reply.scss
M views/journal/quickreply.tt
M views/journal/talkform.tt
M views/journal/talkform.tt.text
Log Message:
-----------
Talkform and quick-reply: Add formats dropdown (PROD STRING UPDATE)
This adds a formatting dropdown to the reply forms, replacing the old "don't
autoformat" checkbox.
- The dropdown goes between the subject and body fields, and the quote button
moves alongside it to provide some visual balance.
- The dropdown sets a value for the `prop_editor` form field. (Currently unused,
but matching the naming convention of the other property-tied comment form
fields like `prop_opt_preformatted` and `prop_picture_keyword`.)
- The available values and default selected value are deferred to DW::Formats.
To help it decide, we tell it:
- The _user-preferred_ format is the comment_editor userprop (currently never
set by anything).
- The _current_ format is whatever was passed in the `prop_editor` field of
the submitted form (not passed for comment edits yet, but it'll already
carry over for "more options", preview, and fixing errors on talkpost_do).
- The help icon is meant to link to a FAQ page all about our formatting options.
On deploy, site owners will need to edit the following strings to make that icon
link to the right place:
- markup.helplink.url
- markup.helplink.alttext
Commit: e772bffa836fadcbde845f514db2004f364e9cd7
https://github.com/dreamwidth/dw-free/commit/e772bffa836fadcbde845f514db2004f364e9cd7
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/Misc.pm
M cgi-bin/DW/Controller/Talk.pm
M cgi-bin/DW/EmailPost/Comment.pm
M cgi-bin/LJ/Comment.pm
M cgi-bin/LJ/Protocol.pm
M cgi-bin/LJ/S2/ReplyPage.pm
M cgi-bin/LJ/Talk.pm
Log Message:
-----------
Comment machinery: Wire prop_editor through everything
Now we're getting somewhere! It goes a little like this, starting at the backend
and moving outwards:
- `edit_comment` and `post/enter_comment` now insert their received
`$comment->{editor}` value into the DB.
- `LJ::Talk::prepare_and_validate_comment` now copies the form's `prop_editor`
value to `$comment->{editor}`
- Comments always pass through either `/talkpost_do` or `LJ::Comment::create`,
both of which now forward `prop_editor` to `prepare_and_validate_comment`.
- Talkform and quick-reply already pass `prop_editor` to `/talkpost_do`.
- `LJ::Protocol::addcomment` now passes `props->{editor}` to
`LJ::Comment::create`.
- `/__rpc_addcomment` (quicker-reply from last-N pages) now forwards
`prop_editor` to Protocol.
- Emailpost now passes `prop_editor` to Protocol.
Also:
- Preview includes the editor value when faking up an unvalidated comment, and
passes the editor value along to `clean_comment` when formatting a WIP comment
for display.
- The comment edit link adds the existing comment's editor to the form values
that get passed to the talkform, so it'll respect the current format.
Commit: 0b7cd2ec2afd2df7f3d7a8c200cbf277a26629e1
https://github.com/dreamwidth/dw-free/commit/0b7cd2ec2afd2df7f3d7a8c200cbf277a26629e1
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M htdocs/scss/pages/entry/new.scss
M views/entry/form.tt
Log Message:
-----------
Beta create entries page: Enable formatting types
This adds an editors dropdown to the beta create entries page, which works
exactly like the one in the comment forms:
- We detect the best-fit editor when editing older content that doesn't have a
value set.
- Preview respects editor value.
- Uses the entry_editor2 userprop for the default format... but as of this
commit, nothing sets that.
Entries: stop auto-setting editor userprop
Commit: 34d694e83c70395759add2c6eb0d59819eada6cd
https://github.com/dreamwidth/dw-free/commit/34d694e83c70395759add2c6eb0d59819eada6cd
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M htdocs/scss/components/quick-reply.scss
M htdocs/scss/pages/entry/new.scss
Log Message:
-----------
Format switcher: Fallback styling for non-flex browsers
Commit: a36b3c7646b4f04808381b918f0925f3f516211d
https://github.com/dreamwidth/dw-free/commit/a36b3c7646b4f04808381b918f0925f3f516211d
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M t/post.t
Log Message:
-----------
Fix/add post tests
Commit: bbfc48c23c131df34255cb11f6c072b9ba5063e4
https://github.com/dreamwidth/dw-free/commit/bbfc48c23c131df34255cb11f6c072b9ba5063e4
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/EmailPost/Base.pm
M cgi-bin/DW/EmailPost/Comment.pm
M cgi-bin/DW/EmailPost/Entry.pm
M htdocs/manage/emailpost.bml
M htdocs/manage/emailpost.bml.text
Log Message:
-----------
Email posts: Enable new `post-format` header, default entries to Markdown
This new header lets you choose which format you want to use for emailed
comments or entries. Since email is sort of halfway between a UI and an API, it
allows two forms of format values:
- Humans typing directly into their mail client should ask for either `html` or
`markdown` (aliases to the current versions of Casual HTML and Markdown), so
they can use what they're familiar with from the web UI.
- Automated integrations (or humans with very particular tastes) should specify
a "real" format ID like `html_casual0`, so they can continue to work predictably
when formats change in the future.
And since there's now a way to opt out of it, emailed entries now default to
Markdown, same as emailed comments.
Commit: 2e011b300813297463b4e256c306ada167b40f61
https://github.com/dreamwidth/dw-free/commit/2e011b300813297463b4e256c306ada167b40f61
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M bin/upgrading/deadphrases.dat
M cgi-bin/DW/Controller/Entry.pm
M views/entry/success.tt
M views/entry/success.tt.text
Log Message:
-----------
Arrange entry success links in a consistent way
(This has driven me nuts for years.)
Commit: 946b59aa37ca3ea1412b105b15c1bc3ca1b8a704
https://github.com/dreamwidth/dw-free/commit/946b59aa37ca3ea1412b105b15c1bc3ca1b8a704
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/User/Journal.pm
M cgi-bin/LJ/User/Permissions.pm
Log Message:
-----------
Add custom getters/setters for comment_editor and entry_editor2 userprops
This makes it easier to compare things against the user's *effective* default
(e.g. if they never set a default), and lets us silently upgrade outdated
defaults.
Commit: 71e6b84679280848bc1612a3aa9c8fcb3078f640
https://github.com/dreamwidth/dw-free/commit/71e6b84679280848bc1612a3aa9c8fcb3078f640
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
A cgi-bin/DW/Controller/Editor.pm
A views/default_editor.tt
A views/default_editor.tt.text
A views/default_editor_form.tt
Log Message:
-----------
Add controller (and templates) for updating default format userprops
A page that wants to offer the chance to update your default (like comment/entry
success pages) can do so with the default_editor_form.tt template fragment.
To reduce clutter, this is a one-button interface rather than a real
choose-a-value setting. That means it should only be displayed after the user
does something that involved choosing a non-default format, so we know which
format we're offering to switch to.
Commit: a04c4a5332f558d742e41633be7db412f05d4168
https://github.com/dreamwidth/dw-free/commit/a04c4a5332f558d742e41633be7db412f05d4168
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Talk.pm
Log Message:
-----------
Add default format update button to comment success page
If the user posted a comment in an active format that isn't their default, give
them the chance to update their default for next time.
Commit: 79e18031a525d91d90059fa8153257ea828191fd
https://github.com/dreamwidth/dw-free/commit/79e18031a525d91d90059fa8153257ea828191fd
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M htdocs/js/jquery.ajaxtip.js
Log Message:
-----------
Add new "sticky" method to ajaxtip
It already has an "error" method that doesn't auto-dismiss on a timer, but that
still dismisses as soon as you mouse past it. To allow some kind of interaction
with the result of an ajaxtip request, you want the pop-up to stay on the screen
until you click away from it. So this lets it do that.
Commit: 353d5060af287cf60e1d0205be6959ac414d8f81
https://github.com/dreamwidth/dw-free/commit/353d5060af287cf60e1d0205be6959ac414d8f81
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/RPC/Misc.pm
M htdocs/js/jquery.quickreply.js
Log Message:
-----------
Add default format update button to quicker-reply success pop-up
The quicker-reply posts via an RPC call instead of talkpost_do, so that you can
stay on your current page. To respect that, we'll show the update button in
the inline success message instead of redirecting to a success page. (This
requires a sticky tooltip.)
Commit: 9a19b3e097a20af2355a514a6d63624612552a70
https://github.com/dreamwidth/dw-free/commit/9a19b3e097a20af2355a514a6d63624612552a70
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/LJ/Talk.pm
A htdocs/js/jquery.default-editor.js
M views/default_editor_form.tt
Log Message:
-----------
Add JavaScript for changing default format without leaving the page
A basic little ajax submit script that hits the default_editor RPC endpoint.
The form fragment can bring the JS in automatically if you're building it into a
page from the beginning, but if the form gets added to a page via ajax (like
with the quicker-reply), the page needs to require the script ahead of time.
Commit: 41fd189ad3fb36d2517d77273fa7bc96e2b72b4a
https://github.com/dreamwidth/dw-free/commit/41fd189ad3fb36d2517d77273fa7bc96e2b72b4a
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M views/entry/success.tt
Log Message:
-----------
Add default format update button to entry success page
There's *sort of* an entries equivalent of the quick-reply (it's the update
widget on the home page), but it's married to the old BML create entries form
and so I'm not going to mess with it right now.
Commit: 5f7601511ef5b568b6e3f3a7829ee657c98ce1cb
https://github.com/dreamwidth/dw-free/commit/5f7601511ef5b568b6e3f3a7829ee657c98ce1cb
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Entry.pm
M cgi-bin/LJ/User/Journal.pm
Log Message:
-----------
Tidy
Commit: 416748735e7351a11976ae0fcce96ceb130d4ba3
https://github.com/dreamwidth/dw-free/commit/416748735e7351a11976ae0fcce96ceb130d4ba3
Author: Nick Fagerlund <nick.fagerlund@gmail.com>
Date: 2020-06-29 (Mon, 29 Jun 2020)
Changed paths:
M cgi-bin/DW/Controller/Editor.pm
M views/default_editor.tt.text
Log Message:
-----------
Editors controller: Check for $r->did_post, include v5.10 pragma
Compare: https://github.com/dreamwidth/dw-free/compare/970896476e25...416748735e73