-
Notifications
You must be signed in to change notification settings - Fork 3
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
Rich text support #11
Merged
Merged
Conversation
This file contains 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
It would be nice not to have the intermediate JSON representation. Unfortunately the object returned by xml2js isn't drop-in compatible with that returned by the JSON parser.
Question: should node_modules be in the repo, or should we gitignore it??
I got it to work as far as rendering bricks and parts go. However, if I try to render the steps, it all goes wrong, and I can't debug the React errors...
It now loads from XML correctly, and can display my file. Next step: adding my improvements to the rendering!
I'd disabled files and components on assembly steps - now fixed.
tried to install a markdown renderer (but it doesn't work from typescript :( )
I tried using an XML tag with a src attribute to load an XML file from disk - but it doesn't seem to work :( I've moved my docubricks to the project/ directory, and gitignored it for cleanliness...
to save duplicating my (large!) docubricks project, I've gitignored it here...
It was assumed that all the images, etc. were defined relative to "./project/" or "./project/name/". I have added a property base_url to the docubricks project class, which allows this to be specified (the default is still "./project/" but I've lost the automatic /name/).
I realised a4eb05e introduces a potential flaw - you could potentially override any page using this viewer code just by specifying docubricks_xml_url in the query string. Now, it only follows that URL if you set the contents of the "docubricks_xml_url" div to a particular value.
I've switched over to DOMParser, but everything's broken...
The browser provides a (native, hopefully fast and bug-free!) parser and manipulation tools for XML DOMs. I've used these instead of an external library, as I hope it will give better XML manipulation tools.
turns out getElementsByTagName didn't do what I thought (it's recursive rather than just returning immediate children).
unsuccessfully tried using an iframe and using a file input control to load the XML file locally - neither worked (yet).
Steo descriptions can now use safe HTML tags. "Safe" HTML is defined in the function domNodeChildrenToReactElements
Attributes are now passed correctly to HTML elements in descriptions. This means hyperlinks work!!
The BOM now contains hyperlinks to the individual parts. Also tweaked the debug printing code for the BOM to make recursion clearer.
<ul> tags were previously modified to remove their bullets globally. Now that they are allowed in the descriptions of steps, I've modified the CSS to disable them only in the sidebar (as they look ugly in the navigation list).
CSS now forces page breaks before bricks - convenient for PDFs. Also, I've added <code> and <pre> to the list of allowed tags.
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.
This branch uses my DOMParser in the browser, and extends the rendering to allow rich text (including hyperlinks) in the various long text fields. This fixes #5 and #6 as well as making it easy to embed into a GitHub microsite or preview a file you're working on without the need to recompile an HTML page (one of the things I wanted to do the most).
It includes everything I did in #7.