Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Page break following cursor #34

Open
poafernandes opened this issue Nov 21, 2017 · 3 comments
Open

Page break following cursor #34

poafernandes opened this issue Nov 21, 2017 · 3 comments

Comments

@poafernandes
Copy link

Hello, I recently started using etherpad and I'm having trouble with page breaks

One of the problems is shown below, where if I go to the line above, the page break dissapears, following the cursor instead of the text already written.

The other problems I think are related to this one, like trying to insert a new page break with enter at the end of the current page and the editor inserting the break for a split second and then removing it instantly. Any tips on how to deal with this?

boooa

@lpagliari
Copy link
Contributor

@poafernandes page break is still a very unstable feature, I would not recommend using it. We've disabled it on our project because of that.

BTW: 2nd problem seems to be the same of #20

@JohnMcLear
Copy link
Owner

+1 disable it. I don't have time to fix at the moment

@jon9m
Copy link

jon9m commented Dec 5, 2017

As a solution to this issue I suggest the following.

page_view.js ----------------------------------------------
line 428 - Add a <br> to the div
$(this).append("<div class='pageBreakComputed' contentEditable=false><br></div>");

shared.js ---------------------------------------------------

var _ = require('ep_etherpad-lite/static/js/underscore');

var collectContentPre = function(hook, context){
  var tname = context.tname;
  var state = context.state;
  var cls = context.cls;
  var lineAttributes = state.lineAttributes

  console.log("PRE lineAttributes : " + JSON.stringify(lineAttributes));

  var tagIndex = tname;
  if(tagIndex >= 0){
    lineAttributes['pageBreak'] = tagIndex;
  }else if(cls.indexOf('pageBreakComputed') != -1){
    lineAttributes['pageBreak'] = tagIndex;
  }
};

var collectContentPost = function(hook, context){
  var tname = context.tname;
  var state = context.state;
  var lineAttributes = state.lineAttributes
  var cls = context.cls;
  var tagIndex = tname;

  console.log("POST lineAttributes : " + JSON.stringify(lineAttributes));

  if(tagIndex >= 0){
    delete lineAttributes['pageBreak'];
  }else if(cls.indexOf('pageBreakComputed') != -1){
    delete lineAttributes['pageBreak'];
  }
};

exports.collectContentPre = collectContentPre;
exports.collectContentPost = collectContentPost;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants