Skip to content

Commit 5ee5b8f

Browse files
authored
Merge pull request #893 from lean-ja/suggest-edit
一瞬 Suggest an edit ボタンが表示される問題を修正する
2 parents bfbf715 + 01a9057 commit 5ee5b8f

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

assets/filePlay.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
/**
22
* mdbook の "Suggest an edit" ボタンを改造し、
33
* lean4 web editor へのリンクにしてしまう
4+
*
5+
* 一瞬元のアイコンが表示されるのを防ぐためにHTML側で上書きを行っていることに注意
46
*/
57
function filePlay() {
68
// 編集ボタンのアイコン部分の `i` 要素
7-
const editButtonIcon = document.querySelector("#git-edit-button");
8-
editButtonIcon.className = "fa fa-play";
9-
editButtonIcon.id = "lean-play-button";
9+
const editButtonIcon = document.querySelector("#lean-play-button");
1010

1111
// 編集ボタンを表す `a` 要素
1212
const editButtonLink = editButtonIcon.parentElement;
13-
editButtonLink.title = "Run on Lean 4 playground";
14-
editButtonLink.ariaLabel = editButtonLink.title;
1513

1614
// 拡張子が `.md` になっているので `.lean` に修正する
1715
editButtonLink.href = editButtonLink.href.replace(/\.md$/, ".lean");

theme/index.hbs

+3-8
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,12 @@
184184
</a>
185185
{{/if}}
186186
{{!--
187-
Discord への招待ボタン
188-
本来はアイコンを Discord のアイコンにすべきだが、mdbook が使用している FontAwesome はバージョンが 4.7.0 であり
189-
Discord のアイコンが存在しない。そのため、コミュニティっぽいアイコンで代用している。
187+
本来編集ページへのリンクだが、改造してファイル単位の実行ボタンにしている
190188
--}}
191-
<a href="https://discord.gg/p32ZfnVawh" title="Join our community" aria-label="Join community">
192-
<i id="discord-invite-button" class="fa fa-comments-o"></i>
193-
</a>
194189
{{#if git_repository_edit_url}}
195-
<a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit"
190+
<a href="{{git_repository_edit_url}}" title="Run on Lean 4 playground" aria-label="Run on Lean 4 playground"
196191
target=_blank>
197-
<i id="git-edit-button" class="fa fa-edit"></i>
192+
<i id="lean-play-button" class="fa fa-play"></i>
198193
</a>
199194
{{/if}}
200195
</div>

0 commit comments

Comments
 (0)