-
Notifications
You must be signed in to change notification settings - Fork 128
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
Draft: Scratch changes for matrix-public-archive
#653
base: master
Are you sure you want to change the base?
Draft: Scratch changes for matrix-public-archive
#653
Conversation
See plan https://docs.google.com/document/d/1wP_TIqmBQjtt862vb2CWWmnmVxTyolcF3J1scuiYMdg/edit# 1. Trying to make it faster/easier to build `hydrogen.es.js` for local linking and dev in `matrix-public-arhive` project 1. Some random changes to accomodate using raw `EventEntry`'s
// find any local relations to these new remote events or maybe these | ||
// new remote events reference one of the other new remote events we have. | ||
const entryList = new ConcatList(entries, this._localEntries); | ||
for (const pee of entryList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes emoji reactions show up on messages.
(the m.reaction
events are in the list of events we're rendering)
…dom`](https://github.com/WebReflection/linkedom) (SSR). - [`linkedom`](https://github.com/WebReflection/linkedom) is being used https://github.com/matrix-org/matrix-public-archive to server-side render (SSR) Hydrogen (`hydrogen-view-sdk`) - This is being fixed by using a explicit HTML wrapper boilerplate with `DOMParser` to get a matching result in the browser and `linkedom`. Currently `parseHTML` is only used for HTML content bodies in events. Events with replies have content bodies that look like `<mx-reply>Hello</mx-reply> What's up` so they're parsed as HTML to strip out the `<mx-reply>` part. Before | After --- | --- ![](https://user-images.githubusercontent.com/558581/153692011-2f0e7114-fcb4-481f-b217-49f461b1740a.png) | ![](https://user-images.githubusercontent.com/558581/153692016-52582fdb-abd9-439d-9dce-3f04da6959db.png) Before: ```js // Browser (Chrome, Firefox) new DOMParser().parseFromString(`<div>foo</div>`, "text/html").body.outerHTML; // '<body><div>foo</div></body>' // `linkedom` ❌ new DOMParser().parseFromString(`<div>foo</div>`, "text/html").body.outerHTML; // '<body></body>' ``` After (consistent matching output): ```js // Browser (Chrome, Firefox) new DOMParser().parseFromString(`<!DOCTYPE html><html><body><div>foo</div></body></html>`, "text/html").body.outerHTML; // '<body><div>foo</div></body>' // `linkedom` new DOMParser().parseFromString(`<!DOCTYPE html><html><body><div>foo</div></body></html>`, "text/html").body.outerHTML; // '<body><div>foo</div></body>' ``` `linkedom` goal is to be close to the current DOM standard, but [not too close](https://github.com/WebReflection/linkedom#faq). Focused on the streamlined cases for server-side rendering (SSR). Here is some context around getting `DOMParser` to interpret things better. The conclusion was to only support the explicit standard cases with a `<html><body></body></html>` specified instead of adding the magic HTML document creation and massaging that the browser does. - WebReflection/linkedom#106 - WebReflection/linkedom#108 --- Part of #653 to support server-side rendering Hydrogen for the [`matrix-public-archive`](https://github.com/matrix-org/matrix-public-archive) project.
@@ -57,7 +58,7 @@ export class RoomView extends TemplateView { | |||
new TimelineView(timelineViewModel) : | |||
new TimelineLoadingView(vm); // vm is just needed for i18n | |||
}), | |||
t.view(bottomView), | |||
bottomView ? t.view(bottomView) : text(''), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just trying to not render the composer when no vm.composerViewModel.kind
matches with the goal to hide the composer.
…h-changes Conflicts: scripts/sdk/base-manifest.json src/platform/web/parsehtml.js
…hrowing and stopping all JavaScript Related to #579 ``` Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'deriveBits') at new Crypto at new Platform at mountHydrogen ```
Split off from #653 Personally using `select`, `option`, and `path` currently in https://github.com/matrix-org/matrix-public-archive but added a few extra SVG elements that seemed common to me.
See #653 (comment) We can allow this to run now since I added support for `setProperty` in `linkedom` ⏩ WebReflection/linkedom#114
…ing in tests Split out from #653 Example test assertions: https://github.com/matrix-org/matrix-public-archive/blob/db6d3797d74104ad7c93e572ed106f1a685a90d0/test/e2e-tests.js#L248-L252 ```js // Make sure the $abc event on the page has "foobarbaz" text in it assert.match( dom.document.querySelector(`[data-event-id="$abc"]`).outerHTML, new RegExp(`.*foobarbaz.*`) ); ```
…op as well and continue reading See `?continue=top` in matrix-org/matrix-viewer#114 for how this is used
This would be helpful for matrix-org/matrix-viewer#73
…h-changes Conflicts: src/domain/session/room/LightboxViewModel.js
… menu option for it now
…h-changes Conflicts: src/domain/ViewModel.ts src/domain/navigation/index.ts src/domain/session/SessionViewModel.js src/domain/session/room/RoomViewModel.js src/domain/session/room/timeline/tiles/BaseMessageTile.js src/domain/session/room/timeline/tiles/SimpleTile.js src/matrix/room/PowerLevels.js src/platform/web/dom/utils.ts src/platform/web/ui/session/room/timeline/BaseMessageView.js
Useful to quickly grab the MXC URL's to quarantine media in moderation scenarios
pushd target/ | ||
# Make sure the dependencies are available for any consuming project that uses | ||
# `npm link hydrogen-view-sdk` | ||
yarn install --no-lockfile | ||
popd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split off to #1100
Scratch changes for
matrix-public-archive
(not available yet)See plan https://docs.google.com/document/d/1wP_TIqmBQjtt862vb2CWWmnmVxTyolcF3J1scuiYMdg/edit#
hydrogen.es.js
for local linking and dev inmatrix-public-arhive
projectyarn run vite build -c vite.sdk-lib-config.js --watch
EventEntry
'sDev notes
Supporting the Node.js CommonJS environment (
package.json
exports
)Getting CommonJS vs EcmaScript Modules working, d7290bf
package.json
Also added
"./assets/": "./asset-build/assets/"
to theexports
so we can simply serve them withapp.use(express.static(path.dirname(require.resolve('hydrogen-view-sdk/assets/'))));
eslint-plugin-node
will complain about these entries but that's because it doesn't supportexports
, see mysticatea/eslint-plugin-node#255package.json
exports
docsDocs source: https://github.com/webpack/webpack.js.org/blob/627c26026678f2f44c40a7631c7799c04936ff40/src/content/guides/package-exports.mdx (served at https://webpack.js.org/guides/package-exports/)
Vite
Server-side render Hydrogen
Can we just render straight to string?
Virtual DOM: