Skip to content

[package:markdown] update package:web references in the example #2039

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

Merged
merged 2 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
sdk: [3.2, dev]
sdk: [3.4, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
Expand Down
2 changes: 2 additions & 0 deletions pkgs/markdown/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Update the README link to the markdown playground
(https://dart-lang.github.io/tools).
* Update `package:web` API references in the example.
* Require Dart `^3.4.0`.

## 7.3.0

Expand Down
18 changes: 10 additions & 8 deletions pkgs/markdown/example/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ final extensionSets = {
};

void main() {
versionSpan.text = 'v${md.version}';
versionSpan.textContent = 'v${md.version}';
markdownInput.onKeyUp.listen(_renderMarkdown);

final savedMarkdown = window.localStorage['markdown'];
final savedMarkdown = window.localStorage.getItem('markdown');

if (savedMarkdown != null &&
savedMarkdown.isNotEmpty &&
Expand All @@ -57,7 +57,7 @@ void main() {

// GitHub is the default extension set.
gfmRadio.attributes.getNamedItem('checked')?.value = '';
gfmRadio.querySelector('.glyph')!.text = 'radio_button_checked';
gfmRadio.querySelector('.glyph')!.textContent = 'radio_button_checked';
extensionSet = extensionSets[gfmRadio.id];
_renderMarkdown();

Expand All @@ -82,7 +82,7 @@ void _renderMarkdown([Event? event]) {

if (event != null) {
// Not simulated typing. Store it.
window.localStorage['markdown'] = markdown;
window.localStorage.setItem('markdown', markdown);
}
}

Expand Down Expand Up @@ -110,19 +110,21 @@ void _switchFlavor(Event e) {
if (target.attributes.getNamedItem('checked') == null) {
if (basicRadio != target) {
basicRadio.attributes.safeRemove('checked');
basicRadio.querySelector('.glyph')!.text = 'radio_button_unchecked';
basicRadio.querySelector('.glyph')!.textContent =
'radio_button_unchecked';
}
if (commonmarkRadio != target) {
commonmarkRadio.attributes.safeRemove('checked');
commonmarkRadio.querySelector('.glyph')!.text = 'radio_button_unchecked';
commonmarkRadio.querySelector('.glyph')!.textContent =
'radio_button_unchecked';
}
if (gfmRadio != target) {
gfmRadio.attributes.safeRemove('checked');
gfmRadio.querySelector('.glyph')!.text = 'radio_button_unchecked';
gfmRadio.querySelector('.glyph')!.textContent = 'radio_button_unchecked';
}

target.attributes.getNamedItem('checked')?.value = '';
target.querySelector('.glyph')!.text = 'radio_button_checked';
target.querySelector('.glyph')!.textContent = 'radio_button_checked';
extensionSet = extensionSets[target.id];
_renderMarkdown();
}
Expand Down
4 changes: 2 additions & 2 deletions pkgs/markdown/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ executables:
markdown:

environment:
sdk: ^3.2.0
sdk: ^3.4.0

dependencies:
args: ^2.0.0
Expand All @@ -31,5 +31,5 @@ dev_dependencies:
pool: ^1.5.1
tar: ^1.0.3
test: ^1.16.0
web: '>=0.4.2 <2.0.0'
web: ^1.0.0
yaml: ^3.0.0