Use lexical in the command line
This commit is contained in:
@@ -27,7 +27,7 @@ gem "rqrcode"
|
||||
gem "redcarpet"
|
||||
gem "rouge"
|
||||
gem "jbuilder"
|
||||
gem "actiontext-lexical", bc: "actiontext-lexical"
|
||||
gem "actiontext-lexical", path: "/Users/jorge/Work/jorgemanrubia/actiontext-lexical"
|
||||
gem "image_processing", "~> 1.14"
|
||||
gem "platform_agent"
|
||||
gem "aws-sdk-s3", require: false
|
||||
|
||||
+6
-7
@@ -1,10 +1,3 @@
|
||||
GIT
|
||||
remote: https://github.com/basecamp/actiontext-lexical
|
||||
revision: 8a2cede49ca51e40004a0f03100b3f189b60fdd8
|
||||
specs:
|
||||
actiontext-lexical (0.1.0)
|
||||
rails (>= 8.0.2)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/basecamp/active_record-tenanted
|
||||
revision: 81a4d02a363fa749de517c90e19588365f934913
|
||||
@@ -209,6 +202,12 @@ GIT
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
zeitwerk (~> 2.6)
|
||||
|
||||
PATH
|
||||
remote: /Users/jorge/Work/jorgemanrubia/actiontext-lexical
|
||||
specs:
|
||||
actiontext-lexical (0.1.0)
|
||||
rails (>= 8.0.2)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
||||
@@ -122,6 +122,22 @@
|
||||
caret-color: var(--color-negative);
|
||||
color: var(--color-negative);
|
||||
}
|
||||
|
||||
.lexical-editor__content {
|
||||
min-block-size: initial;
|
||||
margin: 0;
|
||||
|
||||
b, strong, i, em {
|
||||
font-weight: inherit;
|
||||
font-style: inherit;
|
||||
}
|
||||
|
||||
ul, li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.terminal__label {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Controller } from "@hotwired/stimulus"
|
||||
import { HttpStatus } from "helpers/http_helpers"
|
||||
import { isMultiLineString } from "helpers/text_helpers";
|
||||
import { marked } from "marked"
|
||||
import { nextFrame } from "helpers/timing_helpers";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "input", "form", "output", "confirmation", "recentCommands" ]
|
||||
@@ -14,9 +15,11 @@ export default class extends Controller {
|
||||
|
||||
// Actions
|
||||
|
||||
focus() {
|
||||
this.inputTarget.setSelectionRange(this.inputTarget.value.length, this.inputTarget.value.length)
|
||||
async focus() {
|
||||
await nextFrame()
|
||||
|
||||
this.inputTarget.focus()
|
||||
this.inputTarget.selection.placeCursorAtTheEnd()
|
||||
}
|
||||
|
||||
executeCommand(event) {
|
||||
@@ -38,6 +41,11 @@ export default class extends Controller {
|
||||
this.#hideOutput()
|
||||
}
|
||||
|
||||
submitCommand() {
|
||||
this.formTarget.requestSubmit()
|
||||
this.#reset()
|
||||
}
|
||||
|
||||
handleKeyPress(event) {
|
||||
if (this.waitingForConfirmationValue) {
|
||||
this.#handleConfirmationKey(event.key.toLowerCase())
|
||||
@@ -175,8 +183,7 @@ export default class extends Controller {
|
||||
this.inputTarget.value = this.originalInputValue
|
||||
this.confirmationTarget.value = "confirmed"
|
||||
this.#hideOutput()
|
||||
this.formTarget.requestSubmit()
|
||||
this.#reset()
|
||||
this.submitCommand()
|
||||
}
|
||||
|
||||
#showOutput(markdown) {
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
} do %>
|
||||
<label class="terminal__label txt-nowrap" for="fizzy_do">Fizzy do ></label>
|
||||
|
||||
<%= text_field_tag "command", nil,
|
||||
autocomplete: "off",
|
||||
autocorrect: "off",
|
||||
autocapitalize: "off",
|
||||
<%= rich_textarea_tag "command", nil,
|
||||
toolbar: false,
|
||||
class: "terminal__input input fill-transparent unpad",
|
||||
"single-line": true,
|
||||
data: {
|
||||
terminal_target: "input",
|
||||
action: "keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrReset:stop terminal#hideError"
|
||||
action: "keydown.enter->terminal#submitCommand keydown.up->toggle-class#add:prevent keydown.up->navigable-list#selectCurrentOrReset:stop terminal#hideError"
|
||||
},
|
||||
placeholder: platform.desktop? ? "Press #{ hotkey_label(["ctrl", "K"]) } to search or type commands…" : "Search or type commands…",
|
||||
spellcheck: "false" %>
|
||||
|
||||
Reference in New Issue
Block a user