ZSSRichTextEditor icon indicating copy to clipboard operation
ZSSRichTextEditor copied to clipboard

Inserting link doesn't work

Open michaelloistl opened this issue 9 years ago • 8 comments

When inserting a link it outputs 'insert link' in the console, however no link is getting inserted in the text area. That might be related to #95.

michaelloistl avatar Nov 13 '15 09:11 michaelloistl

I'm experiencing this too.

obuseme avatar Feb 12 '16 17:02 obuseme

I have just tried replicating this issue and it is working for me.

willptswan avatar Sep 02 '16 16:09 willptswan

@michaelloistl @obuseme I am going to close this issue for now but if you can provide clear steps to reproduce this issue and I am able to reproduce it then I will re-open it.

willptswan avatar Sep 02 '16 22:09 willptswan

I'm experiencing this too.

menhui222 avatar Jul 25 '17 02:07 menhui222

I solved . First call [self.editorView stringByEvaluatingJavaScriptFromString:@"zss_editor.prepareInsert();"];

menhui222 avatar Jul 25 '17 03:07 menhui222

This is still an issue. I fixed similar to menuhui22's fix, by inserting: // Save the selection location [self.editorView evaluateJavaScript:@"zss_editor.prepareInsert();" completionHandler:^(NSString *result, NSError *error) { }]; at beginning of: - (void)insertLink:(NSString *)url title:(NSString *)title

101airborne avatar Mar 04 '22 00:03 101airborne

@101airborne Please submit a pull request if you have fixed this issue.

nnhubbard avatar Mar 04 '22 00:03 nnhubbard

I'm sorry but I am not in a position to do a pull request, but here is the entire changed -insertLink:url:title function: `- (void)insertLink:(NSString *)url title:(NSString *)title {

// Save the selection location, preparing for insert - resolves ISSUE #104
[self.editorView evaluateJavaScript:@"zss_editor.prepareInsert();" completionHandler:^(NSString *result, NSError *error) {
 
}];

NSString *trigger = [NSString stringWithFormat:@"zss_editor.insertLink(\"%@\", \"%@\");", url, title];
[self.editorView evaluateJavaScript:trigger completionHandler:^(NSString *result, NSError *error) {
 
}];

if (_receiveEditorDidChangeEvents) {
    [self updateEditor];
}

} `

101airborne avatar Mar 04 '22 00:03 101airborne