pad

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const SystemAuthorId = "a.etherpad-system"

SystemAuthorId is the stable author id used to attribute inserts coming from internal callers (HTTP API SetText/AppendText with no authorId, plugins, server-side import flows). Without ANY author attribute, AText.Text and AText.Attribs drift out of sync — clients then fail setDocAText reconciliation in ace2_inner.ts when loading the pad. Using a fixed system author keeps the AText well-formed without requiring every plugin to allocate its own author up-front. Upstream #7773.

Variables

This section is empty.

Functions

func CleanText

func CleanText(context string) *string

func IsValidPadId added in v0.0.2

func IsValidPadId(padID string) bool

Types

type Copy added in v0.6.3

type Copy struct {
	SrcPad *Pad
	DstPad *Pad
	SrcId  string
	DstId  string
}

Copy is the context passed to the padCopy hook after a pad is copied to a new destination (copyPad, copyPadWithoutHistory, movePad). Mirrors the original Etherpad context, which exposes the source and destination pads.

type Create added in v0.6.0

type Create struct {
	Pad      *Pad
	PadId    string
	AuthorId string
}

Create is the context passed to the padCreate hook right after a pad's first revision is persisted.

type DefaultContent

type DefaultContent struct {
	Type     *string
	Content  *string
	Pad      *Pad
	AuthorId *string
	PadId    string
}

type Load

type Load struct {
	Pad   *Pad
	PadId string
}

type Pad

type Pad struct {
	Id             string
	ChatHead       int
	Head           int
	PublicStatus   bool
	SavedRevisions []revision.SavedRevision
	Pool           apool.APool
	AText          apool.AText

	ReadonlyId *string
	UpdatedAt  *time.Time
	CreatedAt  time.Time
	// contains filtered or unexported fields
}

func NewPad

func NewPad(id string, db db.DataStore, hook *hooks.Hook) Pad

func (*Pad) AddSavedRevision added in v0.0.4

func (p *Pad) AddSavedRevision(author string) error

func (*Pad) AppendChatMessage added in v0.0.2

func (p *Pad) AppendChatMessage(authorId *string, timestamp int64, text string) (*int, error)

func (*Pad) AppendRevision

func (p *Pad) AppendRevision(cs string, authorId *string) (*int, error)

func (*Pad) Check added in v0.0.2

func (p *Pad) Check() error

func (*Pad) GetAllAuthors

func (p *Pad) GetAllAuthors() []string

func (*Pad) GetAllChatters added in v0.0.4

func (p *Pad) GetAllChatters() (*[]string, error)

func (*Pad) GetChatMessages added in v0.0.2

func (p *Pad) GetChatMessages(start int, end int) (*[]db2.ChatMessageDBWithDisplayName, error)

func (*Pad) GetInternalRevisionAText

func (p *Pad) GetInternalRevisionAText(targetRev int) *apool.AText

func (*Pad) GetRevision

func (p *Pad) GetRevision(revNumber int) (*db2.PadSingleRevision, error)

func (*Pad) GetRevisionAuthor

func (p *Pad) GetRevisionAuthor(revNum int) (*string, error)

func (*Pad) GetRevisionChangeset added in v0.0.2

func (p *Pad) GetRevisionChangeset(revNum int) (*string, error)

func (*Pad) GetRevisionDate

func (p *Pad) GetRevisionDate(rev int) (*int64, error)

func (*Pad) GetRevisions added in v0.0.2

func (p *Pad) GetRevisions(start int, end int) (*[]db2.PadSingleRevision, error)

func (*Pad) Init

func (p *Pad) Init(text *string, author *string, authorManager *author.Manager) error

func (*Pad) Remove

func (p *Pad) Remove() error

func (*Pad) RemoveAllChats

func (p *Pad) RemoveAllChats() error

func (*Pad) RemoveAllSavedRevisions

func (p *Pad) RemoveAllSavedRevisions() error

func (*Pad) Save added in v0.0.2

func (p *Pad) Save() error

func (*Pad) SetText

func (p *Pad) SetText(newText string, authorId *string) error

func (*Pad) SpliceText

func (p *Pad) SpliceText(start int, ndel int, ins string, authorId *string) error

func (*Pad) Text

func (p *Pad) Text() string

type Remove added in v0.6.3

type Remove struct {
	Pad   *Pad
	PadId string
}

Remove is the context passed to the padRemove hook when a pad is deleted.

type Update added in v0.6.0

type Update struct {
	Pad       *Pad
	PadId     string
	AuthorId  string
	Revs      int
	Changeset string
}

Update is the context passed to the padUpdate hook after a revision is appended.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL