by peutetre · 2y ago · 0 comments
Sure you can. Google Docs switched to canvas three years ago: https://workspaceupdates.googleblog.com/2021/05/Google-Docs-...
This wasm application renders to canvas and works fine for me: https://bandysc.github.io/AvaloniaVisualBasic6/
This one too: https://flutterweb-wasm.web.app/
Flutter and Google Docs gave up on the DOM because they couldn't get it working well enough, consistently enough across browsers. When you draw to canvas you get more consistent results because you control all the drawing.
You just need to be one of the critical projects for BigTech. Easy peasy, compared to <editor_command> index.html.
> This wasm application renders to canvas and works fine for me: https://bandysc.github.io/AvaloniaVisualBasic6/
Trying to select text on mobile Safari just selects whole canvas. Same for your Flutter example.
What a regression for web. Just so that a couple of snowflakes can use their fad of the day or can stay in their comfort zone.
Or because the DOM is a piece of technology designed for rendering documents and not web apps and with limitations which has been severely gimping proper rendering of web apps for the past decade despite a slew of libraries trying to fill the cracks with various amount of success. Whichever you prefer.
IDK, it seems to have been pretty successful at it to me, being of the most popular GUI frameworks currently, probably the most popular by a wide margin.
Being designed for documents it should exceed at rendering documents.
The problem isn’t on the DOM itself, it’s in mapping other frameworks to it. Of course it‘d be hard to port LibreOffice‘s rendering to the web, it‘d be a crazy amount of work to reach parity.
And it’s fine to argue that it doesn’t make sense at all to use the DOM for non-web document editing: OnlyOffice doesn’t do it either, as far as I’m aware.
It’s just a bummer to me since documents are exactly what the web was made for.
JS was made to animate monkey on a screen, and now it powers internet.
Technologies start with one goal and evolve.
-- Ellen Ullman
A div element is a node in a tree which will be rendered by a very opiniated rendering engine adhering to a fairly strict set of standards, and which can be manipulated using a limited subset of technologies which are themselves fairly opinionated.
A class Rectangle can be pretty much whatever you want.
Ah, so yet again Safari is the problem. The new Internet Explorer unfortunately.
And you can even control zoom/scale on desktop. Very accessible!
I must note (in the interest of factual accuracy, though as you see I loathe the approach) that this is not a fundamental limitation, just something that Flutter and probably ZetaOffice have chosen not to support. You can block such things in a DOM world too, and it’s stupidly common for app-like things to try to do so.
And broke CJK and emoji input. They only fixed emoji input recently. CJK is still broken.
"The shorthand collective name for the Chinese, Japanese, and Korean writing systems."?
Google Docs literally doesn't work in Firefox. (Garbled text.)
For Google not working consistently across browsers is a feature, not a bug.
> Flutter and Google Docs gave up on the DOM because they couldn't get it working well enough, consistently enough across browsers. When you draw to canvas you get more consistent results because you control all the drawing.
And as a side effect, of course if you require the canvas, you will also be able to abuse the canvas, to fingerprint users. It is strange, how those things seemingly always coincide when it comes to Google products.
I'd believe the vast majority of the user base has never noticed anything off with these applications. I have noticed one or two things missing in the in-browser PowerPoint and that's about it. If you want to do precise publication layout, Word (and Writer) are not the appropriate tools - you'll need something like InDesign.
This is the nasty catch-22. It is preferable to have a single tool that handles both simple and complex cases. But sometimes, you just can't make one tool that does both well. If you optimize for the hard cases, then most users will use only a tiny minority of the features.
Microsoft tried to work around that with the "ribbon", which tried to learn which features each individual uses. Users hated it.
So I keep around LibreOffice for the hard stuff, which I write perhaps once a year. And I use Google Docs every day.
It's a toy that's making Google a lot of money.
Flutter… ugh, Flutter on the web is awful awful awful awful awful AWFUL AWFUL and I will hate you if you decide with open eyes to use it when you’re deliberately targeting the web.⁴ I lack energy to express my vitriolic loathing. Just go through https://hn.algolia.com/?query=chrismorgan%20flutter&type=com..., there’s lots of detailed explanation of specifically what’s bad, if you need it.
Avalonia Visual Basic 6? It’s the kind of thing where the limitations will show least, because of how limited it is. And also because it’s imitating (not quite the right word, but close enough) ancient software which itself wouldn’t work fully properly if run on current machines. Its text handling is dodgy, doesn’t do composition properly, scrolling is non-native, context menus are non-native which stops some things from working properly… but honestly that’s kinda the vibe they’re going for, so it’s not particularly upsetting.
Pure-canvas is irredeemably bad. With difficulty you can make some things decent even with it, but excellence is impossible with pure canvas.
Flutter and Google Docs did not give up on DOM for the reasons you cite. Google Docs, I honestly don’t understand why they gave up on DOM, the reasons they cited publicly genuinely don’t make sense. Flutter, it was because they don’t actually care about the web, it’s a third-class target, and too much of the way they design their API doesn’t port to DOM directly, so that making DOM a first-class citizen would have required compromises in their APIs that they were unwilling to make. But it was emphatically not about cross-browser consistency.
—⁂—
¹ Seriously, Google Docs is slower than it used to be, especially with higher latency and jitter.
² The parts they replaced had no consistency problems in any realistic browsers. Seriously. Their layout requirements are, in practice, really basic. The area where consistency can actually be a problem is text shaping and rendering, but they haven’t replaced that since it would tank performance.
³ My favourite example is keyboard navigation. It doesn’t match platform conventions, and that’s really irritating. Since we’re in this thread, LibreOffice also flouts platform conventions in this area, and it’s really irritating.
⁴ If you’re focusing on mobile and make a mobile app with Flutter and also put it on the web with Flutter because why not, better than nothing, I won’t like you very much, but I’ll at least understand. But if you’re saying “we need a web thing, how about we use Flutter”… no.
If you're making an application, there's really nothing special about the DOM.
You might as well control your drawing. That way you don't need to figure out cross browser incompatibilities all day.
And here's what someone who used to work on Google Docs has to say about it:
Use DOM. Please use DOM.
Use canvas for an actual drawing canvas, but for the UI and anything else that’s largely text, use DOM.