react-native-rich-text
Version:
Rich text editor for React Native projects
1,734 lines (1,644 loc) • 516 kB
HTML
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<style>.app-body {
margin: 0px;
}
.floating-toolbar {
position: fixed;
top: 0;
width: 100%;
background-color: white;
}
#editor {
border: hidden !important;
}</style>
<style>/*!
* Quill Editor v1.0.0
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
*/
.ql-container {
box-sizing: border-box;
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 20px;
height: 100%;
margin: 0px;
position: relative;
}
.ql-clipboard {
left: -100000px;
height: 1px;
overflow-y: hidden;
position: absolute;
top: 50%;
}
.ql-clipboard p {
margin: 0;
padding: 0;
}
.ql-editor {
box-sizing: border-box;
cursor: text;
line-height: 1.42;
height: 100%;
outline: none;
overflow-y: auto;
padding: 12px 15px;
tab-size: 4;
-moz-tab-size: 4;
text-align: left;
white-space: pre-wrap;
word-wrap: break-word;
}
.ql-editor p,
.ql-editor ol,
.ql-editor ul,
.ql-editor pre,
.ql-editor blockquote,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor h4,
.ql-editor h5,
.ql-editor h6 {
margin: 0;
padding: 0;
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol,
.ql-editor ul {
padding-left: 1.5em;
}
.ql-editor ol > li,
.ql-editor ul > li {
list-style-type: none;
}
.ql-editor ul > li::before {
content: '\2022';
}
.ql-editor li::before {
display: inline-block;
margin-right: 0.3em;
text-align: right;
white-space: nowrap;
width: 1.2em;
}
.ql-editor li:not(.ql-direction-rtl)::before {
margin-left: -1.5em;
}
.ql-editor ol li,
.ql-editor ul li {
padding-left: 1.5em;
}
.ql-editor ol li {
counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
counter-increment: list-num;
}
.ql-editor ol li:before {
content: counter(list-num, decimal) '. ';
}
.ql-editor ol li.ql-indent-1 {
counter-increment: list-1;
}
.ql-editor ol li.ql-indent-1:before {
content: counter(list-1, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-1 {
counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-2 {
counter-increment: list-2;
}
.ql-editor ol li.ql-indent-2:before {
content: counter(list-2, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-2 {
counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-3 {
counter-increment: list-3;
}
.ql-editor ol li.ql-indent-3:before {
content: counter(list-3, decimal) '. ';
}
.ql-editor ol li.ql-indent-3 {
counter-reset: list-4 list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-4 {
counter-increment: list-4;
}
.ql-editor ol li.ql-indent-4:before {
content: counter(list-4, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-4 {
counter-reset: list-5 list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-5 {
counter-increment: list-5;
}
.ql-editor ol li.ql-indent-5:before {
content: counter(list-5, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-5 {
counter-reset: list-6 list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-6 {
counter-increment: list-6;
}
.ql-editor ol li.ql-indent-6:before {
content: counter(list-6, decimal) '. ';
}
.ql-editor ol li.ql-indent-6 {
counter-reset: list-7 list-8 list-9;
}
.ql-editor ol li.ql-indent-7 {
counter-increment: list-7;
}
.ql-editor ol li.ql-indent-7:before {
content: counter(list-7, lower-alpha) '. ';
}
.ql-editor ol li.ql-indent-7 {
counter-reset: list-8 list-9;
}
.ql-editor ol li.ql-indent-8 {
counter-increment: list-8;
}
.ql-editor ol li.ql-indent-8:before {
content: counter(list-8, lower-roman) '. ';
}
.ql-editor ol li.ql-indent-8 {
counter-reset: list-9;
}
.ql-editor ol li.ql-indent-9 {
counter-increment: list-9;
}
.ql-editor ol li.ql-indent-9:before {
content: counter(list-9, decimal) '. ';
}
.ql-editor .ql-indent-1:not(.ql-direction-rtl) {
padding-left: 3em;
}
.ql-editor li.ql-indent-1:not(.ql-direction-rtl) {
padding-left: 4.5em;
}
.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right {
padding-right: 3em;
}
.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right {
padding-right: 4.5em;
}
.ql-editor .ql-indent-2:not(.ql-direction-rtl) {
padding-left: 6em;
}
.ql-editor li.ql-indent-2:not(.ql-direction-rtl) {
padding-left: 7.5em;
}
.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right {
padding-right: 6em;
}
.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right {
padding-right: 7.5em;
}
.ql-editor .ql-indent-3:not(.ql-direction-rtl) {
padding-left: 9em;
}
.ql-editor li.ql-indent-3:not(.ql-direction-rtl) {
padding-left: 10.5em;
}
.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right {
padding-right: 9em;
}
.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right {
padding-right: 10.5em;
}
.ql-editor .ql-indent-4:not(.ql-direction-rtl) {
padding-left: 12em;
}
.ql-editor li.ql-indent-4:not(.ql-direction-rtl) {
padding-left: 13.5em;
}
.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right {
padding-right: 12em;
}
.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right {
padding-right: 13.5em;
}
.ql-editor .ql-indent-5:not(.ql-direction-rtl) {
padding-left: 15em;
}
.ql-editor li.ql-indent-5:not(.ql-direction-rtl) {
padding-left: 16.5em;
}
.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right {
padding-right: 15em;
}
.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right {
padding-right: 16.5em;
}
.ql-editor .ql-indent-6:not(.ql-direction-rtl) {
padding-left: 18em;
}
.ql-editor li.ql-indent-6:not(.ql-direction-rtl) {
padding-left: 19.5em;
}
.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right {
padding-right: 18em;
}
.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right {
padding-right: 19.5em;
}
.ql-editor .ql-indent-7:not(.ql-direction-rtl) {
padding-left: 21em;
}
.ql-editor li.ql-indent-7:not(.ql-direction-rtl) {
padding-left: 22.5em;
}
.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right {
padding-right: 21em;
}
.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right {
padding-right: 22.5em;
}
.ql-editor .ql-indent-8:not(.ql-direction-rtl) {
padding-left: 24em;
}
.ql-editor li.ql-indent-8:not(.ql-direction-rtl) {
padding-left: 25.5em;
}
.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right {
padding-right: 24em;
}
.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right {
padding-right: 25.5em;
}
.ql-editor .ql-indent-9:not(.ql-direction-rtl) {
padding-left: 27em;
}
.ql-editor li.ql-indent-9:not(.ql-direction-rtl) {
padding-left: 28.5em;
}
.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right {
padding-right: 27em;
}
.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right {
padding-right: 28.5em;
}
.ql-editor .ql-video {
display: block;
max-width: 100%;
}
.ql-editor .ql-video.ql-align-center {
margin: 0 auto;
}
.ql-editor .ql-video.ql-align-right {
margin: 0 0 0 auto;
}
.ql-editor .ql-bg-black {
background-color: #000;
}
.ql-editor .ql-bg-red {
background-color: #e60000;
}
.ql-editor .ql-bg-orange {
background-color: #f90;
}
.ql-editor .ql-bg-yellow {
background-color: #ff0;
}
.ql-editor .ql-bg-green {
background-color: #008a00;
}
.ql-editor .ql-bg-blue {
background-color: #06c;
}
.ql-editor .ql-bg-purple {
background-color: #93f;
}
.ql-editor .ql-color-white {
color: #fff;
}
.ql-editor .ql-color-red {
color: #e60000;
}
.ql-editor .ql-color-orange {
color: #f90;
}
.ql-editor .ql-color-yellow {
color: #ff0;
}
.ql-editor .ql-color-green {
color: #008a00;
}
.ql-editor .ql-color-blue {
color: #06c;
}
.ql-editor .ql-color-purple {
color: #93f;
}
.ql-editor .ql-font-serif {
font-family: Georgia, Times New Roman, serif;
}
.ql-editor .ql-font-monospace {
font-family: Monaco, Courier New, monospace;
}
.ql-editor .ql-size-small {
font-size: 0.75em;
}
.ql-editor .ql-size-large {
font-size: 1.5em;
}
.ql-editor .ql-size-huge {
font-size: 2.5em;
}
.ql-editor .ql-direction-rtl {
direction: rtl;
text-align: inherit;
}
.ql-editor .ql-align-center {
text-align: center;
}
.ql-editor .ql-align-justify {
text-align: justify;
}
.ql-editor .ql-align-right {
text-align: right;
}
.ql-editor.ql-blank::before {
color: rgba(0,0,0,0.6);
content: attr(data-placeholder);
font-style: italic;
pointer-events: none;
position: absolute;
}
.ql-snow.ql-toolbar:after,
.ql-snow .ql-toolbar:after {
clear: both;
content: '';
display: table;
}
.ql-snow.ql-toolbar button,
.ql-snow .ql-toolbar button {
background: none;
border: none;
cursor: pointer;
display: inline-block;
float: left;
height: 29px;
outline: none;
margin: 0px;
padding: 3px 5px;
}
.ql-snow.ql-toolbar button svg,
.ql-snow .ql-toolbar button svg {
float: left;
height: 100%;
}
.ql-snow.ql-toolbar input.ql-image[type=file],
.ql-snow .ql-toolbar input.ql-image[type=file] {
display: none;
}
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label.ql-active,
.ql-snow .ql-toolbar .ql-picker-label.ql-active,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected,
.ql-snow .ql-toolbar .ql-picker-item.ql-selected {
color: #06c;
}
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,
.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,
.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,
.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill,
.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill {
fill: #06c;
}
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,
.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,
.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke-mitter,
.ql-snow .ql-toolbar button.ql-active .ql-stroke-mitter,
.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-mitter,
.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-mitter,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-mitter,
.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-mitter {
stroke: #06c;
}
.ql-snow {
box-sizing: border-box;
}
.ql-snow * {
box-sizing: border-box;
}
.ql-snow .ql-hidden {
display: none;
}
.ql-snow .ql-out-bottom,
.ql-snow .ql-out-top {
visibility: hidden;
}
.ql-snow .ql-tooltip {
position: absolute;
}
.ql-snow .ql-tooltip a {
cursor: pointer;
text-decoration: none;
}
.ql-snow .ql-formats {
display: inline-block;
vertical-align: middle;
}
.ql-snow .ql-formats:after {
clear: both;
content: '';
display: table;
}
.ql-snow .ql-toolbar.snow,
.ql-snow .ql-stroke {
fill: none;
stroke: #444;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 2;
}
.ql-snow .ql-stroke-mitter {
fill: none;
stroke: #444;
stroke-mitterlimit: 10;
stroke-width: 2;
}
.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
fill: #444;
}
.ql-snow .ql-empty {
fill: none;
}
.ql-snow .ql-even {
fill-rule: evenodd;
}
.ql-snow .ql-thin,
.ql-snow .ql-stroke.ql-thin {
stroke-width: 1;
}
.ql-snow .ql-transparent {
opacity: 0.4;
}
.ql-snow .ql-direction svg:last-child {
display: none;
}
.ql-snow .ql-direction.ql-active svg:last-child {
display: inline;
}
.ql-snow .ql-direction.ql-active svg:first-child {
display: none;
}
.ql-snow .ql-editor h1 {
font-size: 2em;
}
.ql-snow .ql-editor h2 {
font-size: 1.5em;
}
.ql-snow .ql-editor h3 {
font-size: 1.17em;
}
.ql-snow .ql-editor h4 {
font-size: 1em;
}
.ql-snow .ql-editor h5 {
font-size: 0.83em;
}
.ql-snow .ql-editor h6 {
font-size: 0.67em;
}
.ql-snow .ql-editor a {
text-decoration: underline;
}
.ql-snow .ql-editor blockquote {
border-left: 4px solid #ccc;
margin-bottom: 5px;
margin-top: 5px;
padding-left: 16px;
}
.ql-snow .ql-editor code,
.ql-snow .ql-editor pre {
background-color: #f0f0f0;
border-radius: 3px;
}
.ql-snow .ql-editor pre {
white-space: pre-wrap;
margin-bottom: 5px;
margin-top: 5px;
padding: 5px 10px;
}
.ql-snow .ql-editor code {
font-size: 85%;
padding-bottom: 2px;
padding-top: 2px;
}
.ql-snow .ql-editor code:before,
.ql-snow .ql-editor code:after {
content: "\A0";
letter-spacing: -2px;
}
.ql-snow .ql-editor pre.ql-syntax {
font-family: "Menlo", "Inconsolata", monospace;
font-size: 18px;
background-color: #f4f6f9;
color: #24292e;
overflow: visible;
}
.ql-snow .ql-editor img {
max-width: 100%;
}
.ql-snow .ql-picker {
color: #444;
display: inline-block;
float: left;
font-size: 14px;
font-weight: 500;
height: 24px;
position: relative;
vertical-align: middle;
}
.ql-snow .ql-picker-label {
cursor: pointer;
display: inline-block;
height: 100%;
padding-left: 8px;
padding-right: 2px;
position: relative;
width: 100%;
}
.ql-snow .ql-picker-label::before {
display: inline-block;
line-height: 22px;
}
.ql-snow .ql-picker-options {
background-color: #fff;
display: none;
min-width: 100%;
padding: 4px 8px;
position: absolute;
white-space: nowrap;
}
.ql-snow .ql-picker-options .ql-picker-item {
cursor: pointer;
display: block;
padding-bottom: 5px;
padding-top: 5px;
}
.ql-snow .ql-picker.ql-expanded .ql-picker-label {
color: #ccc;
z-index: 2;
}
.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill {
fill: #ccc;
}
.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke {
stroke: #ccc;
}
.ql-snow .ql-picker.ql-expanded .ql-picker-options {
display: block;
margin-top: -1px;
top: 100%;
z-index: 1;
}
.ql-snow .ql-color-picker,
.ql-snow .ql-icon-picker {
width: 28px;
}
.ql-snow .ql-color-picker .ql-picker-label,
.ql-snow .ql-icon-picker .ql-picker-label {
padding: 2px 4px;
}
.ql-snow .ql-color-picker .ql-picker-label svg,
.ql-snow .ql-icon-picker .ql-picker-label svg {
right: 4px;
}
.ql-snow .ql-icon-picker .ql-picker-options {
padding: 4px 0px;
}
.ql-snow .ql-icon-picker .ql-picker-item {
height: 24px;
width: 24px;
padding: 2px 4px;
}
.ql-snow .ql-color-picker .ql-picker-options {
padding: 3px 5px;
width: 152px;
}
.ql-snow .ql-color-picker .ql-picker-item {
border: 1px solid transparent;
float: left;
height: 16px;
margin: 2px;
padding: 0px;
width: 16px;
}
.ql-snow .ql-color-picker .ql-picker-item.ql-primary-color {
margin-bottom: toolbarPadding;
}
.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg {
position: absolute;
margin-top: -9px;
right: 0;
top: 50%;
width: 18px;
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=''])::before,
.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=''])::before,
.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=''])::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=''])::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=''])::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=''])::before {
content: attr(data-label);
}
.ql-snow .ql-picker.ql-header {
width: 98px;
}
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
content: 'Normal';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
content: 'Heading 1';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
content: 'Heading 2';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
content: 'Heading 3';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
content: 'Heading 4';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
content: 'Heading 5';
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
content: 'Heading 6';
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
font-size: 2em;
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
font-size: 1.5em;
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
font-size: 1.17em;
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
font-size: 1em;
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
font-size: 0.83em;
}
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
font-size: 0.67em;
}
.ql-snow .ql-picker.ql-font {
width: 108px;
}
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
content: 'Sans Serif';
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before {
content: 'Serif';
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before {
content: 'Monospace';
}
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before {
font-family: Georgia, Times New Roman, serif;
}
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before {
font-family: Monaco, Courier New, monospace;
}
.ql-snow .ql-picker.ql-size {
width: 98px;
}
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
content: 'Normal';
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before {
content: 'Small';
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before {
content: 'Large';
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before {
content: 'Huge';
}
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before {
font-size: 10px;
}
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before {
font-size: 18px;
}
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before {
font-size: 32px;
}
.ql-snow .ql-color-picker.ql-background .ql-picker-item {
background-color: #fff;
}
.ql-snow .ql-color-picker.ql-color .ql-picker-item {
background-color: #000;
}
.ql-toolbar.ql-snow {
border-bottom: 1px solid #ccc;
box-sizing: border-box;
font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
padding: 8px;
}
.ql-toolbar.ql-snow .ql-formats {
margin-right: 15px;
}
.ql-toolbar.ql-snow .ql-picker-label {
border: 1px solid transparent;
}
.ql-toolbar.ql-snow .ql-picker-options {
border: 1px solid transparent;
box-shadow: rgba(0,0,0,0.2) 0 2px 8px;
}
.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label {
border-color: #ccc;
}
.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options {
border-color: #ccc;
}
.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected,
.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover {
border-color: #000;
}
.ql-toolbar.ql-snow + .ql-container.ql-snow {
border-top: 0px;
}
.ql-snow .ql-tooltip {
background-color: #fff;
border: 1px solid #ccc;
box-shadow: 0px 0px 5px #ddd;
color: #444;
margin-top: 10px;
padding: 5px 12px;
white-space: nowrap;
}
.ql-snow .ql-tooltip::before {
content: "Visit URL:";
line-height: 26px;
margin-right: 8px;
}
.ql-snow .ql-tooltip input[type=text] {
display: none;
border: 1px solid #ccc;
font-size: 13px;
height: 26px;
margin: 0px;
padding: 3px 5px;
width: 170px;
}
.ql-snow .ql-tooltip a.ql-preview {
display: inline-block;
max-width: 200px;
overflow-x: hidden;
text-overflow: ellipsis;
vertical-align: top;
}
.ql-snow .ql-tooltip a.ql-action::after {
border-right: 1px solid #ccc;
content: 'Edit';
margin-left: 16px;
padding-right: 8px;
}
.ql-snow .ql-tooltip a.ql-remove::before {
content: 'Remove';
margin-left: 8px;
}
.ql-snow .ql-tooltip a {
line-height: 26px;
}
.ql-snow .ql-tooltip.ql-editing a.ql-preview,
.ql-snow .ql-tooltip.ql-editing a.ql-remove {
display: none;
}
.ql-snow .ql-tooltip.ql-editing input[type=text] {
display: inline-block;
}
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
border-right: 0px;
content: 'Save';
padding-right: 0px;
}
.ql-snow .ql-tooltip[data-mode=link]::before {
content: "Enter link:";
}
.ql-snow .ql-tooltip[data-mode=formula]::before {
content: "Enter formula:";
}
.ql-snow .ql-tooltip[data-mode=video]::before {
content: "Enter video:";
}
.ql-snow a {
color: #06c;
}
.ql-container.ql-snow {
border: 1px solid #ccc;
}</style>
</head>
<body class="app-body">
<div id="editor"></div>
</body>
<script inline>(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
const Quill = require('quill');
const editor = new Quill('#editor', {
modules: {
toolbar: null,
},
placeholder: 'Text',
theme: 'snow',
});
// Receber mensagens do RN
document.addEventListener('message', (data) => {
if (data.data.substr(0, 7) === '$image$') {
const base64 = data.data.substr(7);
// TODO: Should add image to end if editor doesn't have focus
const { index } = editor.getSelection();
editor.insertEmbed(index, 'image', base64);
} else if (data.data[0] === '$') {
const updatedSelector = data.data.slice(1, data.data.length - 1);
const currentFormat = editor.getFormat();
switch (updatedSelector) {
case 'bold': {
editor.format(updatedSelector, !currentFormat.bold, 'user');
break;
}
case 'italic': {
editor.format(updatedSelector, !currentFormat.italic, 'user');
break;
}
case 'h1': {
const updatedFormat = currentFormat.header === 1 ? null : 1;
editor.format('header', updatedFormat, 'user');
break;
}
case 'ul': {
const updatedFormat = currentFormat.list === 'bullet' ? null : 'bullet';
editor.format('list', updatedFormat, 'user');
break;
}
case 'ol': {
const updatedFormat = currentFormat.list === 'ordered' ? null : 'ordered';
editor.format('list', updatedFormat, 'user');
break;
}
case 'code-block': {
editor.format(updatedSelector, !currentFormat['code-block'], 'user');
break;
}
default:
break;
}
} else if (data.data[0] === '{') {
const content = JSON.parse(data.data);
editor.setContents(content);
}
});
// Toda vez que é editado, manda os conteúdos para o RN
editor.on('text-change', () => {
window.postMessage(JSON.stringify(editor.getContents()), '*');
});
},{"quill":2}],2:[function(require,module,exports){
(function (Buffer){
/*!
* Quill Editor v1.3.6
* https://quilljs.com/
* Copyright (c) 2014, Jason Chen
* Copyright (c) 2013, salesforce.com
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Quill"] = factory();
else
root["Quill"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 109);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var container_1 = __webpack_require__(17);
var format_1 = __webpack_require__(18);
var leaf_1 = __webpack_require__(19);
var scroll_1 = __webpack_require__(45);
var inline_1 = __webpack_require__(46);
var block_1 = __webpack_require__(47);
var embed_1 = __webpack_require__(48);
var text_1 = __webpack_require__(49);
var attributor_1 = __webpack_require__(12);
var class_1 = __webpack_require__(32);
var style_1 = __webpack_require__(33);
var store_1 = __webpack_require__(31);
var Registry = __webpack_require__(1);
var Parchment = {
Scope: Registry.Scope,
create: Registry.create,
find: Registry.find,
query: Registry.query,
register: Registry.register,
Container: container_1.default,
Format: format_1.default,
Leaf: leaf_1.default,
Embed: embed_1.default,
Scroll: scroll_1.default,
Block: block_1.default,
Inline: inline_1.default,
Text: text_1.default,
Attributor: {
Attribute: attributor_1.default,
Class: class_1.default,
Style: style_1.default,
Store: store_1.default,
},
};
exports.default = Parchment;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ParchmentError = /** @class */ (function (_super) {
__extends(ParchmentError, _super);
function ParchmentError(message) {
var _this = this;
message = '[Parchment] ' + message;
_this = _super.call(this, message) || this;
_this.message = message;
_this.name = _this.constructor.name;
return _this;
}
return ParchmentError;
}(Error));
exports.ParchmentError = ParchmentError;
var attributes = {};
var classes = {};
var tags = {};
var types = {};
exports.DATA_KEY = '__blot';
var Scope;
(function (Scope) {
Scope[Scope["TYPE"] = 3] = "TYPE";
Scope[Scope["LEVEL"] = 12] = "LEVEL";
Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
Scope[Scope["BLOT"] = 14] = "BLOT";
Scope[Scope["INLINE"] = 7] = "INLINE";
Scope[Scope["BLOCK"] = 11] = "BLOCK";
Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
Scope[Scope["ANY"] = 15] = "ANY";
})(Scope = exports.Scope || (exports.Scope = {}));
function create(input, value) {
var match = query(input);
if (match == null) {
throw new ParchmentError("Unable to create " + input + " blot");
}
var BlotClass = match;
var node =
// @ts-ignore
input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
return new BlotClass(node, value);
}
exports.create = create;
function find(node, bubble) {
if (bubble === void 0) { bubble = false; }
if (node == null)
return null;
// @ts-ignore
if (node[exports.DATA_KEY] != null)
return node[exports.DATA_KEY].blot;
if (bubble)
return find(node.parentNode, bubble);
return null;
}
exports.find = find;
function query(query, scope) {
if (scope === void 0) { scope = Scope.ANY; }
var match;
if (typeof query === 'string') {
match = types[query] || attributes[query];
// @ts-ignore
}
else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
match = types['text'];
}
else if (typeof query === 'number') {
if (query & Scope.LEVEL & Scope.BLOCK) {
match = types['block'];
}
else if (query & Scope.LEVEL & Scope.INLINE) {
match = types['inline'];
}
}
else if (query instanceof HTMLElement) {
var names = (query.getAttribute('class') || '').split(/\s+/);
for (var i in names) {
match = classes[names[i]];
if (match)
break;
}
match = match || tags[query.tagName];
}
if (match == null)
return null;
// @ts-ignore
if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
return match;
return null;
}
exports.query = query;
function register() {
var Definitions = [];
for (var _i = 0; _i < arguments.length; _i++) {
Definitions[_i] = arguments[_i];
}
if (Definitions.length > 1) {
return Definitions.map(function (d) {
return register(d);
});
}
var Definition = Definitions[0];
if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
throw new ParchmentError('Invalid definition');
}
else if (Definition.blotName === 'abstract') {
throw new ParchmentError('Cannot register abstract class');
}
types[Definition.blotName || Definition.attrName] = Definition;
if (typeof Definition.keyName === 'string') {
attributes[Definition.keyName] = Definition;
}
else {
if (Definition.className != null) {
classes[Definition.className] = Definition;
}
if (Definition.tagName != null) {
if (Array.isArray(Definition.tagName)) {
Definition.tagName = Definition.tagName.map(function (tagName) {
return tagName.toUpperCase();
});
}
else {
Definition.tagName = Definition.tagName.toUpperCase();
}
var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
tagNames.forEach(function (tag) {
if (tags[tag] == null || Definition.className == null) {
tags[tag] = Definition;
}
});
}
}
return Definition;
}
exports.register = register;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var diff = __webpack_require__(51);
var equal = __webpack_require__(11);
var extend = __webpack_require__(3);
var op = __webpack_require__(20);
var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
var Delta = function (ops) {
// Assume we are given a well formed ops
if (Array.isArray(ops)) {
this.ops = ops;
} else if (ops != null && Array.isArray(ops.ops)) {
this.ops = ops.ops;
} else {
this.ops = [];
}
};
Delta.prototype.insert = function (text, attributes) {
var newOp = {};
if (text.length === 0) return this;
newOp.insert = text;
if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
newOp.attributes = attributes;
}
return this.push(newOp);
};
Delta.prototype['delete'] = function (length) {
if (length <= 0) return this;
return this.push({ 'delete': length });
};
Delta.prototype.retain = function (length, attributes) {
if (length <= 0) return this;
var newOp = { retain: length };
if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
newOp.attributes = attributes;
}
return this.push(newOp);
};
Delta.prototype.push = function (newOp) {
var index = this.ops.length;
var lastOp = this.ops[index - 1];
newOp = extend(true, {}, newOp);
if (typeof lastOp === 'object') {
if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
return this;
}
// Since it does not matter if we insert before or after deleting at the same index,
// always prefer to insert first
if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
index -= 1;
lastOp = this.ops[index - 1];
if (typeof lastOp !== 'object') {
this.ops.unshift(newOp);
return this;
}
}
if (equal(newOp.attributes, lastOp.attributes)) {
if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
return this;
} else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
return this;
}
}
}
if (index === this.ops.length) {
this.ops.push(newOp);
} else {
this.ops.splice(index, 0, newOp);
}
return this;
};
Delta.prototype.chop = function () {
var lastOp = this.ops[this.ops.length - 1];
if (lastOp && lastOp.retain && !lastOp.attributes) {
this.ops.pop();
}
return this;
};
Delta.prototype.filter = function (predicate) {
return this.ops.filter(predicate);
};
Delta.prototype.forEach = function (predicate) {
this.ops.forEach(predicate);
};
Delta.prototype.map = function (predicate) {
return this.ops.map(predicate);
};
Delta.prototype.partition = function (predicate) {
var passed = [], failed = [];
this.forEach(function(op) {
var target = predicate(op) ? passed : failed;
target.push(op);
});
return [passed, failed];
};
Delta.prototype.reduce = function (predicate, initial) {
return this.ops.reduce(predicate, initial);
};
Delta.prototype.changeLength = function () {
return this.reduce(function (length, elem) {
if (elem.insert) {
return length + op.length(elem);
} else if (elem.delete) {
return length - elem.delete;
}
return length;
}, 0);
};
Delta.prototype.length = function () {
return this.reduce(function (length, elem) {
return length + op.length(elem);
}, 0);
};
Delta.prototype.slice = function (start, end) {
start = start || 0;
if (typeof end !== 'number') end = Infinity;
var ops = [];
var iter = op.iterator(this.ops);
var index = 0;
while (index < end && iter.hasNext()) {
var nextOp;
if (index < start) {
nextOp = iter.next(start - index);
} else {
nextOp = iter.next(end - index);
ops.push(nextOp);
}
index += op.length(nextOp);
}
return new Delta(ops);
};
Delta.prototype.compose = function (other) {
var thisIter = op.iterator(this.ops);
var otherIter = op.iterator(other.ops);
var delta = new Delta();
while (thisIter.hasNext() || otherIter.hasNext()) {
if (otherIter.peekType() === 'insert') {
delta.push(otherIter.next());
} else if (thisIter.peekType() === 'delete') {
delta.push(thisIter.next());
} else {
var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
var thisOp = thisIter.next(length);
var otherOp = otherIter.next(length);
if (typeof otherOp.retain === 'number') {
var newOp = {};
if (typeof thisOp.retain === 'number') {
newOp.retain = length;
} else {
newOp.insert = thisOp.insert;
}
// Preserve null when composing with a retain, otherwise remove it for inserts
var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
if (attributes) newOp.attributes = attributes;
delta.push(newOp);
// Other op should be delete, we could be an insert or retain
// Insert + delete cancels out
} else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
delta.push(otherOp);
}
}
}
return delta.chop();
};
Delta.prototype.concat = function (other) {
var delta = new Delta(this.ops.slice());
if (other.ops.length > 0) {
delta.push(other.ops[0]);
delta.ops = delta.ops.concat(other.ops.slice(1));
}
return delta;
};
Delta.prototype.diff = function (other, index) {
if (this.ops === other.ops) {
return new Delta();
}
var strings = [this, other].map(function (delta) {
return delta.map(function (op) {
if (op.insert != null) {
return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
}
var prep = (delta === other) ? 'on' : 'with';
throw new Error('diff() called ' + prep + ' non-document');
}).join('');
});
var delta = new Delta();
var diffResult = diff(strings[0], strings[1], index);
var thisIter = op.iterator(this.ops);
var otherIter = op.iterator(other.ops);
diffResult.forEach(function (component) {
var length = component[1].length;
while (length > 0) {
var opLength = 0;
switch (component[0]) {
case diff.INSERT:
opLength = Math.min(otherIter.peekLength(), length);
delta.push(otherIter.next(opLength));
break;
case diff.DELETE:
opLength = Math.min(length, thisIter.peekLength());
thisIter.next(opLength);
delta['delete'](opLength);
break;
case diff.EQUAL:
opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
var thisOp = thisIter.next(opLength);
var otherOp = otherIter.next(opLength);
if (equal(thisOp.insert, otherOp.insert)) {
delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
} else {
delta.push(otherOp)['delete'](opLength);
}
break;
}
length -= opLength;
}
});
return delta.chop();
};
Delta.prototype.eachLine = function (predicate, newline) {
newline = newline || '\n';
var iter = op.iterator(this.ops);
var line = new Delta();
var i = 0;
while (iter.hasNext()) {
if (iter.peekType() !== 'insert') return;
var thisOp = iter.peek();
var start = op.length(thisOp) - iter.peekLength();
var index = typeof thisOp.insert === 'string' ?
thisOp.insert.indexOf(newline, start) - start : -1;
if (index < 0) {
line.push(iter.next());
} else if (index > 0) {
line.push(iter.next(index));
} else {
if (predicate(line, iter.next(1).attributes || {}, i) === false) {
return;
}
i += 1;
line = new Delta();
}
}
if (line.length() > 0) {
predicate(line, {}, i);
}
};
Delta.prototype.transform = function (other, priority) {
priority = !!priority;
if (typeof other === 'number') {
return this.transformPosition(other, priority);
}
var thisIter = op.iterator(this.ops);
var otherIter = op.iterator(other.ops);
var delta = new Delta();
while (thisIter.hasNext() || otherIter.hasNext()) {
if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
delta.retain(op.length(thisIter.next()));
} else if (otherIter.peekType() === 'insert') {
delta.push(otherIter.next());
} else {
var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
var thisOp = thisIter.next(length);
var otherOp = otherIter.next(length);
if (thisOp['delete']) {
// Our delete either makes their delete redundant or removes their retain
continue;
} else if (otherOp['delete']) {
delta.push(otherOp);
} else {
// We retain either their retain or insert
delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
}
}
}
return delta.chop();
};
Delta.prototype.transformPosition = function (index, priority) {
priority = !!priority;
var thisIter = op.iterator(this.ops);
var offset = 0;
while (thisIter.hasNext() && offset <= index) {
var length = thisIter.peekLength();
var nextType = thisIter.peekType();
thisIter.next();
if (nextType === 'delete') {
index -= Math.min(length, index - offset);
continue;
} else if (nextType === 'insert' && (offset < index || !priority)) {
index += length;
}
offset += length;
}
return index;
};
module.exports = Delta;
/***/ }),
/* 3 */
/***/ (function(module, exports) {
'use strict';
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArray = function isArray(arr) {
if (typeof Array.isArray === 'function') {
return Array.isArray(arr);
}
return toStr.call(arr) === '[object Array]';
};
var isPlainObject = function isPlainObject(obj) {
if (!obj || toStr.call(obj) !== '[object Object]') {
return false;
}
var hasOwnConstructor = hasOwn.call(obj, 'constructor');
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
// Not own constructor property must be Object
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for (key in obj) { /**/ }
return typeof key === 'undefined' || hasOwn.call(obj, key);
};
module.exports = function extend() {
var options, name, src, copy, copyIsArray, clone;
var target = arguments[0];
var i = 1;
var length = arguments.length;
var deep = false;
// Handle a deep copy situation
if (typeof target === 'boolean') {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
target = {};
}
for (; i < length; ++i) {
options = arguments[i];
// Only deal with non-null/undefined values
if (options != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name];
// Prevent never-ending loop
if (target !== copy) {
// Recurse if we're merging plain objects or arrays
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
if (copyIsArray) {
copyIsArray = false;
clone = src && isArray(src) ? src : [];
} else {
clone = src && isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[name] = extend(deep, clone, copy);
// Don't bring in undefined values
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
}
}
// Return the modified object
return target;
};
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _extend = __webpack_require__(3);
var _extend2 = _interopRequireDefault(_extend);
var _quillDelta = __webpack_require__(2);
var _quillDelta2 = _interopRequireDefault(_quillDelta);
var _parchment = __webpack_require__(0);
var _parchment2 = _interopRequireDefault(_parchment);
var _break = __webpack_require__(16);
var _break2 = _interopRequireDefault(_break);
var _inline = __webpack_require__(6);
var _inline2 = _interopRequireDefault(_inline);
var _text = __webpack_require__(7);
var _text2 = _interopRequireDefault(_text);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var NEWLINE_LENGTH = 1;
var BlockEmbed = function (_Parchment$Embed) {
_inherits(BlockEmbed, _Parchment$Embed);
function BlockEmbed() {
_classCallCheck(this, BlockEmbed);
return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
}
_createClass(BlockEmbed, [{
key: 'attach',
value: function attach() {
_get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
}
}, {
key: 'delta',
value: function delta() {
return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
}
}, {
key: 'format',
value: function format(name, value) {
var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
if (attribute != null) {
this.attributes.attribute(attribute, value);
}
}
}, {
key: 'formatAt',
value: function formatAt(index, length, name, value) {
this.format(name, value);
}
}, {
key: 'insertAt',
value: function insertAt(index, value, def) {
if (typeof value === 'string' && value.endsWith('\n')) {