gofroala

package module
v0.0.0-...-ccd1e3f Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2018 License: MIT Imports: 6 Imported by: 0

README

gofroala (WIP)

Gofroala is a Go library for implementing the Froala WYSIWYG HTML Editor server side with Amazon S3, Google Cloud Storage etc.

Installation

Requirements
go get github.com/graymeta/stow
go get github.com/keekun/gofroala

Usage

Please read the code example.

Development

go run example/main.go

and open

http://localhost:8080/

with Refresh, example code would be rebuid and re-run automatically.

go get github.com/markbates/refresh
refresh init

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project status

Work in process

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFileUploadOptions = &UploadOptions{
	FieldName: "file",
	Validation: &UploadValidationOptions{
		AllowedExts: []string{
			"txt",
			"pdf",
			"doc",
		},
		AllowedMimeTypes: []string{
			"text/plain",
			"application/msword",
			"application/x-pdf",
			"application/pdf",
		},
	},
	ItemURLFunc: func(item stow.Item) (string, error) {
		return item.URL().String(), nil
	},
}
View Source
var DefaultImageUploadOptions = &UploadOptions{
	FieldName: "file",
	Validation: &UploadValidationOptions{
		AllowedExts: []string{
			"gif",
			"jpeg",
			"jpg",
			"png",
			"svg",
			"blob",
		},
		AllowedMimeTypes: []string{
			"image/gif",
			"image/jpeg",
			"image/pjpeg",
			"image/x-png",
			"image/png",
			"image/svg+xml",
		},
	},
	ItemURLFunc: func(item stow.Item) (string, error) {
		return item.URL().String(), nil
	},

	Resize: "",
}
View Source
var DeleteFileHandler = http.HandlerFunc(deleteFile)
View Source
var DeleteImageHandler = http.HandlerFunc(deleteImage)
View Source
var LoadImagesHandler = http.HandlerFunc(loadImages)
View Source
var UploadFileHandler = http.HandlerFunc(uploadFile)
View Source
var UploadFileValidationHandler = http.HandlerFunc(uploadFileValidation)
View Source
var UploadImageHandler = http.HandlerFunc(uploadImage)
View Source
var UploadImageResizeHandler = http.HandlerFunc(uploadImageResize)
View Source
var UploadImageValidationHandler = http.HandlerFunc(uploadImageValidation)

Functions

func NewServeMux

func NewServeMux(prefix string) *http.ServeMux

Types

type UploadOptions

type UploadOptions struct {
	FieldName   string
	Validation  *UploadValidationOptions
	Resize      string
	ItemURLFunc func(item stow.Item) (string, error)
}
var (
	FileUploadOptions  *UploadOptions
	ImageUploadOptions *UploadOptions
	Container          stow.Container
)

type UploadValidationOptions

type UploadValidationOptions struct {
	AllowedExts      []string
	AllowedMimeTypes []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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