Skip to content
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

Intercept the span for user input #79

Closed
arichiardi opened this issue Oct 28, 2015 · 6 comments
Closed

Intercept the span for user input #79

arichiardi opened this issue Oct 28, 2015 · 6 comments

Comments

@arichiardi
Copy link
Contributor

Hello @amasad a question...

Is there a way to intercept, modify, or customize what is the user input <span> ?

It is exactly between jqconsole-prompt and jqconsole-cursor and I would need to customize it in order to provide real time syntax coloring.

Is it difficult to achieve?

@arichiardi
Copy link
Contributor Author

The best would be to be able to intercept the characters, parse them, and write out ANSI (which is supported in Write already).

Another idea is to inject my own <pre><code> or other class so that highlightjs can work on it. but I guess it will result in higher execution time & bad performance.

@arichiardi
Copy link
Contributor Author

Hello @amasad, probably the feature I am looking for is there somewhere. From the README I see:

  • jqconsole-input: The prompt area during input. May have multiple lines.
  • jqconsole-old-input: Previously-entered inputs.

Is it exactly what is between the prompt and the cursor?

The problem is I don't see them in the DOM. Maybe I need to do something to enable it?

@arichiardi
Copy link
Contributor Author

I saw that I basically need to replace $prompt-left but when I do:

 # Sets the text prompt escaping the html and outputting ANSI
  #   @arg text: The text to append. Can contain multiple lines.
  #   @arg escape: Whether the text to write should be html escaped. Optional, defaults to true.
  _FillPromptText: (text, escape=true) ->
    console.log @$prompt_left
    @$prompt_left = @ansi.stylize $(EMPTY_SPAN).text(@$prompt_left.text() + text).html()

I get a big Uncaught TypeError: this.$prompt_left.text is not a function, maybe I am missing something here...

@arichiardi
Copy link
Contributor Author

Oh ok I can't do this, it is not a jQuery DOM element replacement, replaceWith to the rescue :D

@arichiardi
Copy link
Contributor Author

I will solve too this with #81

@arichiardi
Copy link
Contributor Author

This is solved by 5c8b6d5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant