Coder Social home page Coder Social logo

hakawai's Issues

Highlight Issue

I added a data on -setupFakeData method with a long ass string.
[MentionEntity entityWithName:@"ytingasdasdasdlakdlaksdjlkasjdlkajsldkjalksdjlaksjdlkajsldkjalksdjalsdjlaksdjlakjsdljalskjalskdjalskdjlaksjdlkajsdlkajdlkajsdlkajsdlkajsdlkajsdlkajsdlkasjdlkasjd" entityId:@"27"]];

Creation of mentions with long name were still working fine, but when you're highlighting the created mention with long name the bug will occur.

Screenshot of behaviour.
http://imgur.com/a/8uNj4

Error on 3DTouch Select

Error when using 3DTouch keyboard text selection:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString setCursorPosition:]: unrecognized selector sent to instance

OR

[_NSActivityAssertion setCursorPosition:]: unrecognized selector sent to instance

Mentions plugin breaks after manipulating text programmatically

Hello,
I am currently trying to append a space after a mention programmatically. I'm using the code below to accomplish this, for simplicity sake I'm assuming the mention is being added to the end of the text.

    func mentionsPlugin(_ plugin: HKWMentionsPlugin!, createdMention entity: HKWMentionsEntityProtocol!, atLocation location: UInt) {
        // capture existing mentions
        let mentions = plugin.mentions()
        // append a space, this will cause the mentions plug in to lose it's mentions
        textView.text.append(" ")
        // add the captured mentions back to the plugin
        plugin.addMentions(mentions)
        //inform the plugin that we have updated the textview programatically
        plugin.textViewDidProgrammaticallyUpdate(textView)
    }

If the next character that is typed is a control character mentionsPlugin(_ plugin: HKWMentionsPlugin!, stateChangedTo newState: HKWMentionsPluginState, from oldState: HKWMentionsPluginState) is called twice in rapid succession once with a newState of .creatingMention and then with a newState of .quiescent. The chooser view is never presented, and the mentionsPluginWillActivateChooserView and mentionsPluginActivatedChooserView delegate methods are never called.

if the control character is deleted, a space typed, or any other characters are typed before the initial control character the chooser view is presented as expected.

Typing emoji does not fire textViewDidChange delegate method

It doesn't fire any of the related UITextViewDelegate unless a regular character or backspace is used.

However it is noticeable that shouldChangeTextInRange is called with internal delegate. But external delegate version is not called...

This issue has already been mentioned and closed on the same day without a solution.

#45

@Mention does not appear when placed at the end of text

The Hakawai framework is being used in an app to display @mentions in posts. The framework produces a bug where when this is put at the end of entered text the @mention no longer appears. Erasing the text and then trying again will show the @mention.

Adding Mentions view triggers keyboardHide and then keyboardShow

I have added the mentions plugin to my app and have noticed that when the keyboard is showing, loading the mention view will cause the keyboard to re-call the observer notifications.

Load view:
keyboardWillShow
keyboardDidShow

These occur as expected when we load the keyboard.

Type the mention character (# or @)
keyboardWillHide
keyboardDidHide
keyboardWillShow
keyboardDidShow

The keyboard doesn't change at all but these functions are still called.

This is causing issues for me as I am refreshing the tableView under the mentions view when the keyboard appears. Each time I open or close the mentions view this is happening.

Do you have any idea why this could be happening with the mentions view and plugin?

Simon

Reference to HKWMentionsChooserPositionModeCustomNoLockArrowPointingDown is ambiguous

When my objective-c project didn't have the bridging-header file, my project was working fine. But when I created the bridging-header file, as I am using swift in my project , it started giving me the error in files where I imported HKWTextView.h.

The error is "Definition of 'HKWTextView' must be imported from module 'Hakawai.HKWTextView' before it is required"

screen shot 2018-06-05 at 2 39 04 pm

And then when I used #import <Hakawai/Hakawai-umbrella.h> , it got resolved.
But I still don't understand the concept and use of this file.

And If I am importing this file in .h file of this screenshot's base class , it still gives error

screen shot 2018-06-05 at 2 42 14 pm

why is it so?

How to set the placeholder for HKWTextView?

How can I set the placeholder for HKWTextView ? I have UITextView instance of HKWTextView. I have set the delegate to implement the features.Now I am trying to call textViewDidBeginEditing and textViewDidEndEditing,but none of these delegate getting called.

        _postTextView.simpleDelegate = self;
        _postTextView.externalDelegate = self;

But textViewDidBeginEditing and textViewDidEndEditing not getting called.

  • (void)textViewDidBeginEditing:(HKWTextView *)textView
    {
    //want to call this
    }
  • (void)textViewDidEndEditing:(HKWTextView *)textView
    {
    //want to call this
    }

How to do this?

Using custom class HKWTextView on StoryBoard doesn't show keyboard

Hello!, Im trying to implement this feature in my project and I have to say that it is really awesome!, I've managed to implemented the sibling project for Android but I cannot managed to do the same on iOS. The problem comes when subclassing the TextView on my storyboard to HKWTextView.

I am implementing this feature in a old project with Swift 3.0.
I have a TextView inside a Cell within a TableView and when I change the textview class to HKWTextView and create an outlet of type

@IBOutlet weak var textView: UITextView! the keyboard doesnt show anymore and I'm not able to select the input text to write. It just doesn't let me introduce anything.

Do you have any idea why could it be?

Thank you so much.

Mentions plugin "disappears"

Hello,
my view hierarchy is like this

  • controller view
  • * tableview
  • * * tableviewcell (contentView)
  • * * * container view
  • * * * * hakawai text view, configured with mention plugin, with a small frame (ie 200x64)

when the textview becomes first responder on "keyboard will appear" I change the hierarchy like this (by calling [self.view addSubview:containerView] and then applying fullscreen constraints)

  • controller view
  • tableview
  • * tableviewcell (contentView)
  • container view (with proper fullscreen frame)
  • * hakawai text view
  • * chooser view

unfortunately at this point after I type some text I experience very strange problems when I trigger the mention plugin:

  1. for an instant before the plugin table view appears I can see the background (like if there were no textview at all)

  2. as soon as I try to "select" a mention the plugins disappear, the textview becomes empty, and no mention is appended, the cursor blink but when I try to trigger the plugin again it does not work

  3. if I press backspace several times, it gets like reseted and then the control characted triggers the plugin again; sometimes at this point I can properly add a mention but as soon as I try to type more the textview becomes empy again

I understand this is bizarre, I'm using latest version from cocoapods. Any advice ?

UIControl bounds

Hello, I noticed the bounds of the child UIControl do not resize properly (also confirmed on the demo app using "Debug view hierarchy" with iPhone5S emulator). For me this is a problem, because I move my textview around using constraints to set it to fullscreen and uicontrol do not get the proper bounds this way; from an end user point of view some portions of the "single line" textview are not sensible to touch gestures when the mention plugin is visible.

At the moment I've been able to do a workaround for ios8 (not working on ios7) using constraints and removing the explicit code to sync its frame with the textview one (ie setFrame and layoutSubview) but there is probably an easier fix. Any help is appreciated, thanks :)

Hide the Top Arrow from Plugin

I have integrated Hakawai and it's working perfectly.

One issue is I need to remove the top Line with the Arrow on top of the textview.

Note: I'm using the default chooser view with custom table view cell.

Not working with input methods that insert unconfirmed text during user entering

With such input methods, Hakawai can't detect user interaction with the text view correctly because some assumptions are not true any more, such as that the user can only insert one character by tapping one key on the keyboard.

Example 1

  1. Use Chinese input method
  2. Press test
  3. Select the first candidate test
  4. The marked text test disappears and nothing inserted

hakawai-issue-1

Example 2

  1. Use Chinese input method
  2. Press @tes
  3. s is not inserted and also the marked text te disappears

hakawai-issue-2

Insert Control Character programmatically and start mention picker automatically

I want to do exactly what the LinkedIn iPhone app is doing. Tap an @ button in the inputAccessoryView which them inserts the @ symbol into the UITextView and starts the mention picker dropdown.

I have the beginning part working. When I tap the button it inserts my control character (@) but it does not start the mention picker. This only happens when I actually type an @ symbol.

Any help with this would be great appreciated. I have a feeling it's a simple fix and I am just missing something.

I thought the method textViewDidProgrammaticallyUpdate was the key but it doesn't seem to be working for me.

Trigger mentions programmatically?

Is there a way to enter mention-pick state by code? I.e. simulate action key of explicit mention.

This is requirement I have to place '#' button in convenient place. I tried

[textView insertText...]

or

[textView replaceRange:withText:]

with no success. I.e. control character is being inserted to text, but no mention autocomplete list shows up.

Cursor stops when deleting text while using Mentions plugin

This bug can be verified in the LinkedIn app's new post view:

  1. type a somewhat long message into the textview
  2. hold down the delete button

Observe behavior that after deleting some text the cursor will get stuck and stop deleting characters until you let off the button and re-press. I suspect this has something to do with the code that deals with partially deleting names of Mentions, e.g. turning "Ryan Downing" into "Ryan", but I haven't investigated further. Happy to provide more info if needed / take a look with you.

Editing Mention after setting text to textview programmatically

Hello Dear,
Mentions works nice in the Create mode.

Now on Edit screen. I am preloading textView with text that contains mentions.
But Hakawai textView does not highlight those mentions which are set programatically as textView.text = "Hi XYZMention".

If I add new mention it highlights the new mention, when I call plugin.mentions() method it only returns the mentions that are newly created (typed by user) not the one that were already present in the text when textview is initialized.

I have also tried creating HKWMentionsAttribute for mentions that previously there in text and added it to plugin but still not working.

Here is my code

if let mentions = objPost?.mentions
{
for mention in mentions
{
let mentionAttrib = HKWMentionsAttribute()
mentionAttrib.entityIdentifier = String(mention.id!)

      let str = messageString

      let range = (mention.start! - 1)..<(mention.start! + mention.length! - 1)

      let mySubstring = str[range]
      mentionAttrib.mentionText = mySubstring
      mentionAttrib.entityIdentifier = String(mention.id!)
      mentionAttrib.metadata = ["id": mention.id!, "type": 1, "length": mention.length!]
      mentionAttrib.range = NSMakeRange(mention.start! - 1, mention.length!)

      plugin!.addMention(mentionAttrib)
    }
  }

   plugin?.textViewDidProgrammaticallyUpdate(txtPost)

Please provide solution

Adjacent Mentions Classified as One

If I inserted a mention fck_trmp and inserted again the same mention immediately after the first mention fck_trmpfck_trmp, it will be classified as a single mention

Mentions plugin : HKWRoundedRectBackgroundAttributeName broken in swift

  1. HKWRoundedRectBackgroundAttributeName not work in swift when i manual set this attribute
unselectedMentionAttributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14),
                             NSAttributedStringKey.foregroundColor: UIColor.black,
                             HKWRoundedRectBackgroundAttributeName: HKWRoundedRectBackgroundAttributeValue.init(backgroundColor: UIColor("#f2faff"))],
selectedMentionAttributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 14),
                           NSAttributedStringKey.foregroundColor: UIColor.white,
                           HKWRoundedRectBackgroundAttributeName: HKWRoundedRectBackgroundAttributeValue.init(backgroundColor: UIColor("#718dff"))])
  1. mention backgroundColor height not correct when i select mention (cause of set selected metion attributes font size less than textview size)

and i hope can support mention attribute inset control

TextView text disappears when chooser view appears

With the 3.1.0 release, custom fonts for selected/unselected mentions are working (not sure if this is related).

But, as soon as the mention chooser view appears, all text in the TextView disappears. I can continue typing (although I can't see what I'm entering); as soon as the chooser view disappears, all of the text comes back, still with the correct formatting.

How do you change the position of the selection list?

你的代码十分强大.但是现在我的疑问是如何改变选择列表的位置.让它不呈现在输入框内部.因为我需要做类似 Facebook 的评论功能. 选择列表是浮现在输入框的上面.我应该如何修改?

Buffer Bug 'resumeMentionsPriorString / buffer'

Bug: invalid prefix / buffer was sent to the delegate (plugin's mentionDelegate)

Steps to replicate:

  • Make sure the plugin's resumeMentionsCreationEnabled property is set to YES
  1. Insert a random sentence.
  2. Initiate to create a mention somewhere between the sentence.
  3. Resign the HKWTextView
  4. Make the HKWTextView as first responder
  5. Invalid prefix / buffer was sent to the delegate BUG

Unable to change height constraint of custom chooser view

I am setting up my custom chooser view with the following constraints like so:

UIView *keyboardToolbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 50)];
keyboardToolbar.translatesAutoresizingMaskIntoConstraints = NO;

[_mentionsPlugin setChooserTopLevelView:keyboardToolbar attachmentBlock:^(UIView *view) {
    [keyboardToolbar addConstraint:[NSLayoutConstraint constraintWithItem:view
                                                                attribute:NSLayoutAttributeHeight
                                                                relatedBy:NSLayoutRelationEqual
                                                                   toItem:keyboardToolbar
                                                                attribute:NSLayoutAttributeHeight
                                                               multiplier:1.0
                                                                 constant:0.0]];
}];

textView.inputAccessoryView = keyboardToolbar;

When the keyboardToolbar is initialized, it has the frame {0, 0, 375, 50} on an iPhone 6. After the setup block is called, I get this error:

Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7fae93f30b10 V:[UIView:0x7fae93cab380(50)]>",
    "<NSLayoutConstraint:0x7fae93f140d0 HTUserMentionChooserView:0x7fae93abef40.height == UIView:0x7fae93cab380.height>",
    "<NSAutoresizingMaskLayoutConstraint:0x7fae93f09bd0 h=--& v=--& V:[HTUserMentionChooserView:0x7fae93abef40(100)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fae93f140d0 HTUserMentionChooserView:0x7fae93abef40.height == UIView:0x7fae93cab380.height>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Custom Mentions

Anyone can help me with adding custom mentioning outside the text view ?

How to apply UITableViewAutomaticDimension in HKWTextView insice Cell

Hello everyone!, does anybody managed to use UITableViewAutomaticDimension within a HKWTextView inside a Cell?.

I have a ViewController that has a TableView inside with two cells. The first one has an TextView and the second one is UIView (like the image below)
UIViewController

The followed was working for a time now but with no problem, using the UITableViewAutomaticDimension the cell resize within its own content, the second cell the linkCell was listening to an input and when it recognises an url it show a preview of the url.

Now I was able to add the mentions feature..but I want to have the first cell with a UITableViewAutomaticDimension attribute but if I set the tableView.rowHeight = UITableViewAutomaticDimension(as it was before) the text view (now the HKWTextView) isn't showing...

Do you know what I am missing?

Thank you so much

Unable to select values from the Default chooser view

I have done the initial setup of Hakawai Textview, but when I select the value from Table View, it just dismisses, the selected value is not appearing in my textview also the Cursor disappears!

Someone please help me on this!

textViewShouldBeginEditing not called

Hello,

when I use the mention/any plugin my textViewShouldBeginEditing external delegate method is not called. Would it be possible to have it processed anyway ?
My textview has a "fake" placeholder that needs to be removed on that delegate, apparently doing that on didBeginEditing will set the mention in a wrong internal state preventing me from creating a mention at location 0 (I open another bug for this).

thanks

Mention issue

hi,

Inside the mention delegate method i need to send a network request after typing 3 letters after @ sign and get the data, rather already having data. Then process the local search function on that data.
Is there any possible suggestions?

Swift Compatibility

Can I use LinkedIn/Hakawai framework in Xcode Version 8.3.3 and with swift 3 and above !!

Custom Chooser view example.

Hi.

I'm trying to replicate "the marking someone in a post comment" situation. When you have a keyboard up and there's a tableview that rises with the possible entities to mark. (Image reference: http://imgur.com/a/w58jK)

Any insights are welcomed. The documentation is quite scarce.

Thanks!

Spell checking is disabled

Hey,
I've noticed spellCheckingType is always overridden to .no.
I can fix it but I wanted to understand the logic first.

Part of the initial setup of HKWTextView is

[self.parentTextView overrideSpellCheckingWith:UITextSpellCheckingTypeNo];

I didn't understand when it returns to the original setting, please shed some light on this one :)

The only way I succeed solving it is commenting out the line above, nothing on my side solved it, even using the overrideSpellCheckingType: method.

Thanks.

Setting a different font for `unselectedMentionAttributes` causes text view to overwrite textView's text styling

If I initialize the mention plugin as follows:

_mentionsPlugin = [HKWMentionsPlugin mentionsPluginWithChooserMode:HKWMentionsChooserPositionModeCustomLockBottomNoArrow
                                                 controlCharacters:[NSCharacterSet characterSetWithCharactersInString:@"@"]
                                                      searchLength:3
                                       unselectedMentionAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:16],
                                                                     NSForegroundColorAttributeName : [UIColor blackColor],
                                                                     NSBackgroundColorAttributeName : [UIColor lightGrayColor]}
                                         selectedMentionAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:16],
                                                                     NSForegroundColorAttributeName : [UIColor whiteColor],
                                                                     NSBackgroundColorAttributeName : [UIColor blackColor]}];
/* any other setup */

textView.controlFlowPlugin = _mentionsPlugin;

the font for the non-mention text in the textView is reset to the UITextView default value (I think system font of size 12).

Simulating a placeholder break the mention plugin

Hello,

on my text view I set a fake placeholder text that I need to remove before editing starts. To accomplish this I've some logic to eventually set the textView text to @"" on my delegate textViewDidBeginEditing. Unfortunately in this case I can't create a mention anymore at location 0 by pressing control characters; mention creating can be resumed by writing/deleting some text and then it works at location 0 too.
Looking at the code when my user tap the text view I still have my fake "placeholder text" and the internal state is set at "Stalled" because it believes I'm tapping in a middle of a world.

It would be great if you could add support for a placeholder :) meanwhile could you have a look at this problem ?

thanks in advance

HakawaiDemo causes Assertion failure when using text selection on 'abstractions' demo on iOS 8.1.2

I got the following error once, but could not reproduce it again:

2015-03-11 17:33:11.734 HakawaiDemo[6681:3380888] *** Assertion failure in -[HKWAbstractionLayer textViewShouldChangeTextInRange:replacementText:], ~/Hakawai/Core/AbstractionLayer/HKWAbstractionLayer.m:302
2015-03-11 17:33:11.741 HakawaiDemo[6681:3380888] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Internal error'
*** First throw call stack:
(0x187e5659c 0x1989d00e4 0x187e5645c 0x188cdd554 0x1000d8bb0 0x1000e05e0 0x18cd3e790 0x18c8547b4 0x18c853efc 0x18c853a98 0x18cd72d50 0x18c807400 0x18c7c426c 0x18c7c3d08 0x18c7c1c78 0x18cd72d50 0x18ca8e1c0 0x18c7c0070 0x18c630950 0x18c7bfde0 0x18c7bfb64 0x18c63c228 0x18c6358b0 0x18c608fa8 0x18c8a7f58 0x18c607510 0x187e0e9ec 0x187e0dc90 0x187e0bd40 0x187d390a4 0x190eaf5a4 0x18c66e3c0 0x1000d3acc 0x19903ea08)
libc++abi.dylib: terminating with uncaught exception of type NSException

HKWTextView can't resume mention creation

Bug:

Invoking resignFirstResponder on HKWTextView while on the state of HKWMentionsStartDetectionStateCreatingMention doesn't resign the HKWTextView completely. This also makes the functionality to resume mention creation to halt.

Steps to replicate:

  • Make sure the plugin's resumeMentionsCreationEnabled property is set to YES
  1. Initiate to create a mention
  2. While on mention creation state, resign the HKWTextView
  3. Made the HKWTextView as first responder
  4. BUG

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.