Skip to content

Commit fd33191

Browse files
committed
Refactor command IDs in main.ts and add modal-button style in styles.css
1 parent 4838640 commit fd33191

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

main.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class RubyWasmPlugin extends Plugin {
5454

5555
// This adds a simple command that can be triggered anywhere
5656
this.addCommand({
57-
id: "run-in-modal-command",
57+
id: "run-in-modal",
5858
name: "Run in Modal",
5959
editorCallback: (editor: Editor) => {
6060
const code = editor.getSelection();
@@ -71,7 +71,7 @@ export default class RubyWasmPlugin extends Plugin {
7171

7272
// This adds an editor command that can perform some operation on the current editor instance
7373
this.addCommand({
74-
id: "run-in-editor-command",
74+
id: "run-in-editor",
7575
name: "Run in Editor",
7676
editorCallback: (editor: Editor, view: MarkdownView) => {
7777
const code = editor.getSelection();
@@ -152,8 +152,11 @@ class CodeModal extends Modal {
152152
});
153153
resultElement.textContent = this.result || "result";
154154

155-
const closeButton = contentEl.createEl("button", { text: "Close" });
156-
closeButton.style.cssText = "float: right;";
155+
const closeButton = contentEl.createEl("button", {
156+
cls: "modal-button",
157+
attr: { type: "button" },
158+
text: "Close",
159+
});
157160
closeButton.addEventListener("click", () => {
158161
this.close();
159162
});

styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ available in the app when your plugin is enabled.
66
If your plugin does not need CSS, delete this file.
77
88
*/
9+
button.modal-button {
10+
float: right;
11+
margin: 0.75em 0;
12+
}

0 commit comments

Comments
 (0)