-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the option to pick between panel and dialog
- Loading branch information
1 parent
0e5f769
commit d50a80b
Showing
8 changed files
with
235 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export function getDialogHTML() { | ||
return ` | ||
<div> | ||
<h3>Search and replace</h3> | ||
<form> | ||
<table> | ||
<tr> | ||
<td><input class="expand" type="text" name="pattern-txt" value="{pattern}" placeholder="Find"></td> | ||
</tr> | ||
<tr> | ||
<td><input class="expand" type="text" name="replacement-txt" value="{replacement}" placeholder="Replace"></td> | ||
</tr> | ||
</table> | ||
<table> | ||
<tr> | ||
<td>Options:</td> | ||
<td> | ||
<input type="checkbox" id="wrap-chk" name="wrap-chk" {wrap}><label for="wrap-chk">Wrap around</label><br> | ||
<input type="checkbox" id="matchcase-chk" name="matchcase-chk" {matchcase}><label for="matchcase-chk">Match case</label><br> | ||
<input type="checkbox" id="matchwholeword-chk" name="matchwholeword-chk" {matchwholeword}><label for="matchwholeword-chk">Match whole words only</label><br> | ||
<input type="checkbox" id="preservecase-chk" name="preservecase-chk" {preservecase}><label for="preservecase-chk">Preserve case</label> | ||
</td> | ||
<td> | ||
<input type="radio" id="useliteralsearch-rad" name="matchmethod" value="literal" {matchmethod-literal}><label for="useliteralsearch-rad" checked>Literal search</label><br> | ||
<input type="radio" id="usewildcards-rad" name="matchmethod" value="wildcards" {matchmethod-wildcards}><label for="usewildcards-rad">Use Wildcards</label><br> | ||
<input type="radio" id="useregex-rad" name="matchmethod" value="regex" {matchmethod-regex}><label for="useregex-rad">Use Regular Expression</label> | ||
</td> | ||
</tr> | ||
</table> | ||
</form> | ||
<!--<p class="small-text"> | ||
If you enable regular expressions, it's going to use JavaScript regex. See MDN docs to learn more. | ||
</p>--> | ||
</div>`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import joplin from "api"; | ||
import { SettingItemType } from "api/types"; | ||
|
||
/** | ||
* Returns all settings the user can/has set. | ||
*/ | ||
export async function getSettings() { | ||
return { | ||
"SARGUIPreference": await joplin.settings.value('SARGUIPreference') | ||
} | ||
} | ||
|
||
/** | ||
* Register this plugin"s settings to Joplin. | ||
*/ | ||
export async function registerAllSettings() { | ||
const section = "SAROptions"; | ||
|
||
await joplin.settings.registerSection(section, { | ||
label: "Search & Replace", | ||
description: "Search & Replace", | ||
iconName: "fas fa-search" | ||
}); | ||
|
||
await joplin.settings.registerSettings({ | ||
["SARGUIPreference"]: { | ||
public: true, | ||
section: section, | ||
type: SettingItemType.String, | ||
isEnum: true, | ||
value: "panel", | ||
label: "GUI Preference", | ||
description: "If you don't like the panel, you can switch to a popup dialog instead.", | ||
options: { | ||
"panel": "Open a panel (default, recommended)", | ||
"dialog": "Open a dialog (like in previous versions)" | ||
}, | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
#joplin-plugin-content { | ||
min-width: 400px; | ||
font-size: 10pt; | ||
font-family: Roboto; | ||
} | ||
|
||
input[type="text"] { | ||
width: 380px; | ||
display: inline-block; | ||
box-sizing: border-box; | ||
color: var(--joplin-color); | ||
background-color: var(--joplin-background-color); | ||
border: 1px solid rgba(136, 136, 136, 0.3); | ||
padding: 4px 6px; | ||
border-radius: 3px; | ||
} | ||
|
||
td { | ||
vertical-align: top; | ||
} |