Commit 1cc790b5 by ramdayalmunda

doc editor fixes

parent 44af4271
...@@ -88,10 +88,6 @@ ...@@ -88,10 +88,6 @@
.a-doc-editor .body .sidebar-body{ .a-doc-editor .body .sidebar-body{
flex: 1; flex: 1;
padding: 8px; padding: 8px;
left: 20%;
right: 20%;
top: 0;
bottom: 0;
text-align: center; text-align: center;
overflow: auto; overflow: auto;
display: flex; display: flex;
......
...@@ -31,7 +31,8 @@ var ADocEditor = function (customConfig) { ...@@ -31,7 +31,8 @@ var ADocEditor = function (customConfig) {
var config = null; var config = null;
var canvasList = [] var canvasList = []
const dataTypes = [ const dataTypes = [
"paragraph", "paragraph", // simple text filled line by line
"list", // sequence of line that preserves indentation
] ]
var dataSet = [ var dataSet = [
{ {
...@@ -184,10 +185,8 @@ var ADocEditor = function (customConfig) { ...@@ -184,10 +185,8 @@ var ADocEditor = function (customConfig) {
ctx.save() ctx.save()
let maxWidth = config.pageSetup.canvasWidth let maxWidth = config.pageSetup.canvasWidth
let lines = []
let wordStartIndex = 0 let wordStartIndex = 0
let wordEndIndex = 0 let wordEndIndex = 0
let words = ""
let wordsLength = 0; let wordsLength = 0;
dataSet.formatedText = [] dataSet.formatedText = []
for (let i = 0; i < dataSet.plainContent.length; i++) { for (let i = 0; i < dataSet.plainContent.length; i++) {
...@@ -229,7 +228,6 @@ var ADocEditor = function (customConfig) { ...@@ -229,7 +228,6 @@ var ADocEditor = function (customConfig) {
} }
for (let i = 0; i < dataSet.formatedText.length; i++) { for (let i = 0; i < dataSet.formatedText.length; i++) {
ctx.save() ctx.save()
ctx.font = `${dataSet.formatedText[i].fontSize}px ${dataSet.formatedText[i].fontFamily}` ctx.font = `${dataSet.formatedText[i].fontSize}px ${dataSet.formatedText[i].fontFamily}`
...@@ -383,10 +381,9 @@ var ADocEditor = function (customConfig) { ...@@ -383,10 +381,9 @@ var ADocEditor = function (customConfig) {
destory, destory,
loadContent: function (data) { loadContent: function (data) {
dataSet = JSON.parse(JSON.stringify(data)) dataSet = JSON.parse(JSON.stringify(data))
reRenderPages(dataSet)
caretData.activeData = null caretData.activeData = null
caretData.activeData = dataSet[0] caretData.activeData = dataSet[0]
caretData.index = dataSet[0].plainContent.length
reRenderPages(dataSet)
}, },
getContent: function (){ getContent: function (){
return JSON.parse( JSON.stringify( dataSet ) ) return JSON.parse( JSON.stringify( dataSet ) )
......
...@@ -10,6 +10,12 @@ function setData() { ...@@ -10,6 +10,12 @@ function setData() {
{ {
id: `1`, id: `1`,
type: "text", type: "text",
plainContent: "Hello World!",
},
{
id: `2`,
type: "text",
plainContent: "Did you ever hear about the Great Ice Age or the Pleistocene Epoch? Less than one million years ago, in fact, some 12,000 years ago, an ice sheet many thousands of feet thick rode over Burke Mountain in a southeastward direction.", plainContent: "Did you ever hear about the Great Ice Age or the Pleistocene Epoch? Less than one million years ago, in fact, some 12,000 years ago, an ice sheet many thousands of feet thick rode over Burke Mountain in a southeastward direction.",
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment