fixed: direct DOM manipulation on drag placeholder instead of using capp methods + formatting

This commit is contained in:
daboe01 committed 2016-09-30 16:03:36 +02:00
1 parent 1206654d98
commit 8dc1369ba3
1 file changed
+5 -6
+5 -6
View File
@@ -942,13 +942,12 @@ var kDelegateRespondsTo_textShouldBeginEditing
var placeholderRect = CGRectIntersection([_layoutManager boundingRectForGlyphRange:_selectionRange inTextContainer:_textContainer], _frame),
dragPlaceholder;
placeholderRect.size.width += 10; // prevent wrapping
placeholderRect.size.width += 2; // prevent wrapping
dragPlaceholder = [[CPTextView alloc] initWithFrame:placeholderRect];
[dragPlaceholder insertText:[_textStorage attributedSubstringFromRange:CPMakeRangeCopy(_selectionRange)]];
#if PLATFORM(DOM)
dragPlaceholder._DOMElement.style.backgroundColor = "transparent";
dragPlaceholder._DOMElement.style.opacity = "0.5";
#endif
[dragPlaceholder setBackgroundColor:[CPColor colorWithRed:1 green:1 blue:1 alpha:0]];
[dragPlaceholder setAlphaValue:0.5];
var stringForPasting = [_textStorage attributedSubstringFromRange:CPMakeRangeCopy(_selectionRange)],
richData = [_CPRTFProducer produceRTF:stringForPasting documentAttributes:@{}],
draggingPasteboard = [CPPasteboard pasteboardWithName:CPDragPboard];
@@ -2001,7 +2000,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
var point = [info draggingLocation],
location = [self _characterIndexFromRawPoint:point];
_movingSelection = CPMakeRange(location, 0)
_movingSelection = CPMakeRange(location, 0);
[_caret _drawCaretAtLocation:_movingSelection.location];
[_caret setVisibility:YES];
}