HTML Tool PoC spike for fragment defined in type index#151
HTML Tool PoC spike for fragment defined in type index#151jg10-mastodon-social wants to merge 5 commits intomainfrom
Conversation
| it('is whitelisted by sanitizeHtmlTool', () => { | ||
| const sanitized = sanitizeHtmlTool('<pos-label/>'); | ||
| expect(sanitized).toEqual('<pos-label/>'); | ||
| }); |
There was a problem hiding this comment.
As noted in #126 (comment), my intention here is that each white-listed component would manage its own set of tests to ensure that the HTML sanitization whitelists the right attributes etc. So when other changes are made, then these HTML sanitization tests are also updated.
(This is obviously dependent on getting DOMPurify to run correctly in the tests.)
97bc483 to
61b93f9
Compare
| ], | ||
| fragment: '<pos-label/>', | ||
| }, | ||
| ]; |
There was a problem hiding this comment.
This will need to be loaded from type index with defaults for missing values. New PodOS core methods will be needed.
There was a problem hiding this comment.
This will involve new methods on https://github.com/pod-os/PodOS/blob/main/core/src/type-index/TypeIndex.ts
I propose that the new method will be TypeIndex.htmlTools(resourceUri)
| <SelectedTool class="tool visible"></SelectedTool> | ||
| {SelectedTool == 'pos-html-tool' ? ( | ||
| <pos-html-tool | ||
| fragment={(this.currentTool as HTMLToolConfig).fragment} |
There was a problem hiding this comment.
This is not quite the right solution to support more than one HTML tool (if several types match). It doesn't allow them to be addressed separately through URL params.
There was a problem hiding this comment.
I'm considering instead allowing tools to be registered with a unique name. This would be user friendly but require an additional predicate to be present in the registration.
Another alternative would be a hash of their content. This would more opaque.
There was a problem hiding this comment.
I now propose to add a level of indirection so that a tool can be referred to by URI even when a fragment is specified. This has the advantage that it decouples from the type index.
I plan to use
@prefix : <#>.
@prefix tools: <https://pod-os.org/vocab/tools#>
:TypeIndexRegistration1 tools:htmlTool :Tool1.
:Tool1 tools:htmlToolFragment "<pos-label>".<pos-html-tool uri="http://example.com/Tool1">|
The current implementation works - navigating to |
Closes #146
Keep a Changelog