Comments (11)
Hi @amellnik, this is a good catch. A quick investigation reveals that when hitting back, Prism is run on the <code>
element before the example is interpolated in.
Our code highlight component was initially meant for our static website demos, and listening to changes to its inner text requires quite the refactor. I will raise this to the team and we will see if we can fix it, how and when.
In the meantime, we do have a wrapper component that we have been using for more complex demos: example.ts
It is slightly more dynamic, you don't have to worry about escaping brackets since you use interpolation (just like you've been doing in your demo app), and is slightly easier to use. That said, it still doesn't listen to example code changes, but that's as easy as using a setter on the input:
private _code: string;
public get code() {
return this._code;
}
@Input("clrCode") public set code(raw: string) {
this._code = raw;
this.codeHighlight.redraw();
}
I hope this helps.
from clarity.
@youdz I found there is a problem in the demo code (maybe a defect for CodeHighlight component). When the @Input("clrCode") public code: string;
changed in the parent component, the code highlight block is still the old value. The component variable code
is changed, but the rendered DOM is not changed.
from clarity.
Code highlight component is targeted for removal in 0.12.
from clarity.
We will when we officially deprecate it in the next release.
from clarity.
@CrisLi: Thanks for the bug report, we will look at it and probably fix it as part of a more general refactor of the code highlight component, because at the moment it really doesn't support anything dynamic.
from clarity.
One further thought -- once it can handle dynamic content it would be nice to have an easy way to enable code highlighting on a text or textarea input, specifying the language and possibly even the refresh rate (ie, wait for 1 second without changes to re-color).
from clarity.
The link to the example.ts
file is broken.
from clarity.
It got moved here: https://github.com/vmware/clarity/blob/master/src/app/_utils/code-example.ts
from clarity.
Would it make sense to add a note to the top of the code highlight documentation saying that it will be removed in the future?
from clarity.
Deprecation notice provided.
from clarity.
Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.
from clarity.
Related Issues (20)
- [clr-datagrid] Details pane throws change detection error HOT 2
- [clr-datagrid] focus issues when details pane is opened HOT 4
- add reset all filter option in datatable HOT 4
- The detailButton of Clarity Datagrid Row is with wrong type in the datagrid-row.d.ts HOT 3
- Source map error and webpack 5 HOT 1
- cannot work updateFilterValue with custom filters HOT 4
- Icon 'script-execute' and 'script-schedule' not in icon/index.js HOT 4
- Attaching change event listener on Toggle
- White space after filter is applied. HOT 4
- Documentation for read-only missing HOT 2
- Read-only attribute not working for select-input component HOT 2
- Lack of badge for namespaces icon HOT 4
- Datagrid pageSize is not saved to localestore after page refresh HOT 2
- clrDgSelected on DatagridRow behaves inconsistently HOT 5
- Publish as Ivy Distribution HOT 3
- clr-ui uncompiled sass variable HOT 1
- Website navigation child of section expands a section on first click HOT 1
- CdsDropdown throws an exception in jsdom HOT 3
- Possible missing @clr/core 4.0.16? HOT 1
- Why is this repository archived?
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 clarity.