Repository navigation
The source arrives laid out, and a link that carried it follows it - #29
Merged
Merged
Conversation
The Format button goes: a source that arrives is laid out and taken out of its code fence, so nobody has to ask. A source opened from a link or a file, and one pasted over all of the text (or into an empty editor), arrives that way; a paste into the text, and text that is not JSON, go in as they are. Where the editor cannot load, the textarea lays a whole paste out too. A page opened by a link that carried a source (#source=) now keeps the link in step: when the source changes to another JSON source, the address is replaced, not added to the history, with the new source on one line, deflated where the browser can. A change of layout, and text that is not JSON, leave it as it was; an emptied editor leaves #source= with nothing after it, so the next source is written; a link that cannot be read gives way to the source the person writes. A page opened with no source in its address never writes one. formatSource moves to json-scan.ts, which the editor's chunk can use without the author package.
The editor section loses the Format button and gains the two behaviours that replace it, the source laid out as it arrives and the address kept in step with it. editor.ts and json-scan.ts are linked now that both are on main.
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
On a phone the message and its Show where button wrap to two lines, and the one line that was kept for it moved what is under it when a mistake appeared. Below 700px the line keeps two. Measured at 1100, 768, 390 and 320px: the usual message moves what is under it by at most 3px, and a long one that wraps once more by a line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28.
The Format button goes. A source arrives laid out, so nobody has to ask for it, and a page opened by a link that carried the source keeps the link in step with it.
What changes
formatSourcemoves tojson-scan.ts, so the editor's chunk can use it without the author package.#source=replaces its address when the source changes to another JSON source: the source on one line, compressed with raw deflate where the browser hasCompressionStreamand that is shorter, so the link stays short to send on. It ishistory.replaceState, so the history gets no new entry and the page does not read the address back. A change of layout writes nothing, and text that is not JSON leaves the address as it was, so a link never carries a broken source. An emptied editor leaves#source=with nothing after it, so the next source is written; a link that could not be read gives way to the source the person writes. A page opened with no source in its address never writes one. The write waits for a pause in the typing, as Safari allows a hundred in thirty seconds, and one it refuses is tried again at the next change.index.njkandsite.css: the button and its row go. The line that says where the JSON is wrong keeps a line of its own, two below 700 px where its message wraps, so what is under it does not move as a mistake comes and goes: at 1100, 768 and 390 px the usual message moves it by 3 px at most, and a long one that wraps once more by a line; at 320 px every message wraps to three lines and moves it by one. The hint under the source says the two things above.docs/h5p-build-page.mdsays it, under The source editor, and linkseditor.tsandjson-scan.tsnow that both are onmain.Nothing is sent anywhere: the address is written in the browser, and a fragment no server sees. The page's script is 396 kB (138 kB gzip), up 1 kB; the editor's chunk is the size it was.
Tested
pnpm build,pnpm typecheckandpnpm e2e: 35 pass, where 29 did. The Format test is two now: a whole paste laid out, out of its code fence, and any other paste as it is (into the text, or of text that is not JSON); and a file laid out, with no Format button on the page. A link's source is asserted laid out, and Tab leaves the editor for the next control. New:CompressionStream;The tests that watch the page still fail on any policy report or page error. I looked at it in light and dark at desktop width and at 390 px, with a mistake in the JSON and without.