work around copy and paste background color

This commit is contained in:
j 2019-02-01 13:38:30 +05:30
parent dd48312aff
commit 6eabeda7a1
2 changed files with 31 additions and 13 deletions

View file

@ -1,16 +1,28 @@
.OMLQuoteBox {
position: relative;
}
.OMLQuote { .OMLQuote {
position: relative;
padding: 8px; padding: 8px;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
background-color: rgb(255, 255, 255);
font-family: Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif; font-family: Georgia, Palatino, DejaVu Serif, Book Antiqua, Palatino Linotype, Times New Roman, serif;
font-size: 14px; font-size: 14px;
line-height: 21px; line-height: 21px;
} }
.OMLAnnotation.selected .OMLQuote { .OMLAnnotation .OMLQuoteBackground {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgb(255, 255, 255);
}
.OMLAnnotation.selected .OMLQuoteBackground {
background-color: rgb(128, 192, 255); background-color: rgb(128, 192, 255);
} }
.OMLAnnotation .OxPlaceholder { .OMLAnnotation .OxPlaceholder {
display: none; display: none;
} }

View file

@ -1,11 +1,10 @@
'use strict'; 'use strict';
oml.ui.annotation = function(annotation, $iframe) { oml.ui.annotation = function(annotation, $iframe) {
var $quote = Ox.Element() var $quotetext = Ox.Element()
.addClass('OxSelectable OMLQuote') .addClass('OxSelectable OMLQuote')
.append( .html(Ox.encodeHTMLEntities(annotation.text).replace(/\n/g, '<br/>'))
Ox.Element().html(Ox.encodeHTMLEntities(annotation.text).replace(/\n/g, '<br/>')) .on({
).on({
click: function(event) { click: function(event) {
that.select() that.select()
$iframe.postMessage('selectAnnotation', { $iframe.postMessage('selectAnnotation', {
@ -13,6 +12,13 @@ oml.ui.annotation = function(annotation, $iframe) {
}) })
} }
}) })
var $quote = Ox.Element()
.addClass('OMLQuoteBox')
.append(
Ox.Element().addClass('OMLQuoteBackground')
).append(
$quotetext
)
var notes = annotation.notes.length ? annotation.notes.map(function(note) { var notes = annotation.notes.length ? annotation.notes.map(function(note) {
note.editable = !note.user note.editable = !note.user
return note return note