Comments (7)
This is a good issue. Live preview doesn't capture everything, but I am trying. Can you give me some namespace examples?
I recently added support for complex page names (page names within page names): [[This is a page [[with embedded]] page]]
from workbench.
I prepared here an example and steps to reproduce: https://roamresearch.com/#/app/alexchiri_public/page/08-26-2020
It actually breaks only when the namespaces are collapsed using Ctrl-C Ctrl-L, which is how I keep them always in my Roam graph. Use the link above to try to reproduce it, I was able to do so in an incognito window just now. Hope it helps and let me know if you need more info.
And thanks for building Roam42, it's really great to see all the nice tools the community builds!
from workbench.
Alex good find. Also have a similar problem with complex links [[sample page [[with embedded page]] ]] if the bracket viw is turned off CTRL C, CTRL B
This problem is a bit more complex to solve. I at some point will rewrite live preview and make it more robust. For now, it will be a while before I can fix this.
I really appreciate your time thought to document the problem. I am copying your sample here for future reference:
- Steps to reproduce issue:
- Enable Roam 42 here: [[Roam42]]
- Press Ctrl-C Ctrl-L once so the
Books
namespace collapses to the first letter only: [[Books/Interesting book]] becomesB/Interesting book
- Enable Live Preview
- Hover over this link [[Books/Interesting book]] and look at the console in developer tools
from workbench.
No worries, not a big issue. I now know that it works if namespaces are not collapsed.
from workbench.
My issue with non-collapsed namespaces (e.g., [[B1]] instead of [[Book/B1]]) is that I have different styles (color, etc.) for each namespace, and for the none-collapsed one, [[Book/B1]], there is no namespace tag in the HTML that my CSS can select and apply the desired style.
So expanding namespaces is not an ideal solution for me. Here is my quick fix: In the live preview JS code there is a mouseover event listener where I added a few lines of code (in bold):
document.addEventListener('mouseover', (e) => {
const target = e.target;
const isPageRef = target.classList.contains('rm-page-ref');
const isPageRefTag = target.classList.contains('rm-page-ref-tag');
const isPageRefNameSpace = target.classList.contains('rm-page-ref-namespace-color');
// remove '#' for page tags
if(isPageRefTag){
var text = target.innerText.slice(1)
} else if(isPageRefNameSpace) {
var text = target.parentElement.getAttribute('data-link-title')
} else {
var text = target.innerText;
}
This has fixed my problem and loads the preview for collapsed namespaces.
from workbench.
Thanks for this code snippet. I added it to the code and will be a part of the next release. If you want to test it now, pop into the #roam42 slack channel. There we have info about how to access the test version.
from workbench.
from workbench.
Related Issues (20)
- Make Dictionary Better
- Last PR's weren't merged HOT 2
- Add Scroll to workbench live preview
- Support Week I YYYY as a weekly format HOT 1
- Nuking 'Help' HOT 1
- Copy block ref is redundant HOT 3
- Multiple commands do not work HOT 3
- Add weekly notes to calendar
- Last Publish Failed HOT 1
- Import article in roam HOT 1
- Workbench>Hot keys. when a block is zoom-in state, and you use the hotkey "Go up a block"("Go down a block"), I hope it will keep the zoom-in state then jump to the previous sibling(next sibling) HOT 2
- Attribute Select: Update "Page Attribute"
- Moving multiple blocks with Inbox doesn't maintain tree structure HOT 1
- Cannot import Chinese articles HOT 1
- Workbench alerts not working on iPhone and Android HOT 3
- shortcut letters not appearing on favorite page names
- Expand a block reference using Deep Nav
- Accounting for new lines in OCR feature
- Add Format Converter Options
- Live Preview is blocked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from workbench.