import { Rule } from './Rule' ; import { Book } from '../book' ; import { PageMaker } from '../types' ; import { RegionGetter } from 'regionize/dist/types/types' ; abstract class OutOfFlow extends Rule { continue ? : string ; constructor ( options ) { super ( options ) ; this . name = 'Out of Flow' ; } createOutOfFlowPages ( elmt , book , makeNewPage ) { throw Error ( 'createOutOfFlowPages must be overridden' ) ; } beforeAdd ( elmt ) { elmt . setAttribute ( 'data-ignore-overflow' , 'true' ) ; return elmt ; } afterAdd ( elmt , book , continueOnNewPage , makeNewPage ) { this . createOutOfFlowPages ( elmt , book , makeNewPage ) ; if ( this . continue !== 'same' || book . currentPage . hasOutOfFlowContent ) { continueOnNewPage ( ) ; if ( this . continue === 'left' || this . continue === 'right' ) { book . currentPage . setPreference ( this . continue ) ; } } return elmt ; } } export default OutOfFlow ;