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

defining hashtag, links and adding hyperlinks #176

Open
RomanKozlovskiy opened this issue May 8, 2024 · 12 comments
Open

defining hashtag, links and adding hyperlinks #176

RomanKozlovskiy opened this issue May 8, 2024 · 12 comments
Labels
feature New feature or request

Comments

@RomanKozlovskiy
Copy link

Good afternoon
Please tell me, does the library have a function for determining hashtags and links, as well as adding hyperlinks?
I tried to find information in the documentation but couldn't find anything.

@danielsaidi
Copy link
Owner

Hi @RomanKozlovskiy

@DominikBucher12 started implementing link support, but it's not yet merged.

@danielsaidi danielsaidi added the feature New feature or request label May 8, 2024
@RomanKozlovskiy
Copy link
Author

thank you very much for the information!

@S1D1T1
Copy link

S1D1T1 commented May 8, 2024

I am exploring an adjacent feature - where text is some sort of clickable token, like a hashtag. I expect it to be difficult. For starters, I would want to intercept a mouseclick.

@DominikBucher12
Copy link
Collaborator

@S1D1T1 I have mebtions and hashtag locally running as well thats next feature that will be implemented

@S1D1T1
Copy link

S1D1T1 commented May 8, 2024

@DominikBucher12
I'd be interested to see that. My use isn't for hashtags or mentions, but for a scripting environment, where a variable name is a token. Similar to how variables are displayed in the Mac Shortcuts app- see attached graphic. the tokens should be "atomic" to the text editor - treated like a single character for purposes of cursor movement. I want to execute code when the token is clicked, to present a dialog with the token's properties.

image0

@danielsaidi
Copy link
Owner

That looks amazing! I'd love to use this library for snippet variables, but have no clue how to get started haha.

@S1D1T1
Copy link

S1D1T1 commented May 8, 2024

another UI model for handling a text token: address entry in Mail.app. You start out typing text, but when you complete a known address, it becomes an address object. it has a dropdown menu for managing its properties.

@DominikBucher12
Copy link
Collaborator

With TextKit2 this is very possible and actually more easy, I need to merge that PR with textKit2 in order to add those more "complex" features. I will try to sít down and take a look at that this week so I can merge those 2 PRs that are there for months.

@S1D1T1
Copy link

S1D1T1 commented May 8, 2024

@DominikBucher12, to give a bigger picture, my app is a prompt authoring tool for AI image generation. It currently already supports syntax coloring, parentheses matching. My intention for variable tokens is to take the place of the clauses currently enclosed in { }. In the example below, I want to represent the first clause with a variable "#Genre" whose options can be set elsewhere. (My users have 100's of options to plug in there!)

When this script executes, it creates multiple image prompts, from the different combinations of these variable values, ie;
"beautiful watercolor of sparkle and snow"
"sharp photograph of sparkle and snow"
.. etc..

Screenshot 2024-04-17 at 7 10 11 PM

@S1D1T1
Copy link

S1D1T1 commented May 12, 2024

@DominikBucher12 Can you tell me more about this change, and textkit 2? I would like to assess whether this will fit my needs. I'm not familiar with textkit2 - I see it's a new text editing library from Apple, but not in SwiftUI? At this point, just being able to intercept a mouse click or a .contextMenu would give me a starting point.
I've also considered implementing my "tokens" as embedded Images, making use of RTK's RTF capabilities. That would handle all the cursor movement perfectly, since they're already treated like a single character, and flow with text. But it sounds like your potential change might be better. Feel free to direct me to unfinished products, I'm fine working with a prototype

@martindufort
Copy link
Contributor

martindufort commented May 16, 2024

Looks like I would also have a need to do this and intercept taps / mouse clicks and apply functions to a link or an image attachment.

In my case, I would like to easily turn a line into a todo item, shown via an square image, by clicking a button. Then when the use clicks the image, the todo will be marked completed by swithching the image to a checkbox.square image.

What is needed to accomplish this in RTK?

@danielsaidi
Copy link
Owner

I'm a bit overwhelmed by the activity in this project, and would love be able to give it more time and attention. As of now, I however have to focus on some other project and freelance gigs, but can take a look at whatever you come up with.

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

No branches or pull requests

5 participants