Skip to content

Commit

Permalink
master: v1.0-rc2 release
Browse files Browse the repository at this point in the history
 - Add stunning logo.
 - And Grunt task for minifying js and executing from it the tasks (only checking with jscs, for the moment).
  • Loading branch information
eljulians committed Jul 26, 2016
1 parent efc7955 commit bb9e2cc
Show file tree
Hide file tree
Showing 9,451 changed files with 622,985 additions and 21 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
before_script:
npm install jscs -g
- npm install -g grunt-cli
- npm install

script: jscs js/table-of-contents.js
script: grunt default
29 changes: 29 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = function(grunt) {
grunt.initConfig({
jscs: {
src: 'js/table-of-contents.js',
options: {
config: '.jscsrc'
}
},
uglify: {
options: {
mangle: false,
compress: {
drop_console: true
}
},
js: {
files: [{
src: 'js/table-of-contents.js',
dest: 'js/table-of-contents.min.js'
}]
}
}
});

grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', ['jscs', 'uglify']);
}
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TinyMCE Table of Contents creator
=================================

[![Build Status](https://api.travis-ci.org/julenpardo/tinymce-table-of-contents.svg)](https://travis-ci.com/julenpardo/tinymce-table-of-contents) ![Release](https://img.shields.io/badge/release-v1.0--rc1-blue.svg) ![License](https://img.shields.io/badge/license-GPLv3-blue.svg)
[![Build Status](https://api.travis-ci.org/julenpardo/tinymce-table-of-contents.svg)](https://travis-ci.com/julenpardo/tinymce-table-of-contents) ![Release](https://img.shields.io/badge/release-v1.0--rc2-blue.svg) ![License](https://img.shields.io/badge/license-GPLv3-blue.svg)

A plugin for TinyMCE text editor & WordPress for creating tables of contents in an incredibly easy and personalizable way.

Expand All @@ -10,6 +10,16 @@ A plugin for TinyMCE text editor & WordPress for creating tables of contents in
- Configuration of the indentation of the levels of the table.
- Option to add to the elements of the table link to each section.

### How is the indentation added?

The indentation of each level of the table is just a set of ` `, styled with `white-space: pre;`, to make the browser preserve them.

### How are the links added?

The links are added by adding an `id` attribute to each title appearing in the table of contents, but only if it doesn't have it; original `id` attributes are not overwritten, not to break any other possible reference.

The format of the generated `id` is `section_x`, `section_x_y`, etc. Then, the link is just a hyperlink to the `id` (e.g., `<a href="#section_x">Section X</a>`).

## Installation
1. Download it (check the [releases section](https://github.com/julenpardo/tinymce-table-of-contents/releases)).
2. Unzip the contents into a `table-of-contents` named folder.
Expand Down
Binary file added img/table-of-contents.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions js/table-of-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
// Add Button to Visual Editor Toolbar
editor.addButton( 'table_of_contents', {
title: 'Table of contents',
cmd: 'table_of_contents'
cmd: 'table_of_contents',
image: url + '/../img/table-of-contents.png'
});
editor.addCommand( 'table_of_contents', function() {
editor.windowManager.open( {
Expand Down Expand Up @@ -225,7 +226,7 @@
indentation = '<span style="white-space: pre;">' + indentation + '</span>';

return indentation;
}
}

/**
* Creates the link for the element of the table of contents that points to the corresponding title section in the
Expand Down
1 change: 1 addition & 0 deletions js/table-of-contents.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/grunt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb9e2cc

Please sign in to comment.