Skip to content

Commit 6c0353d

Browse files
committed
Update README and TypeScript definitions for autoDisableDuplicateSearching
1 parent 6ad133e commit 6c0353d

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,23 @@ The next step is to set up a `template` to link `code-input` to your syntax-high
7676
function(result_element) { /* Highlight function - with `pre code` code element */
7777
/* Highlight code in result_element - code is already escaped so it doesn't become HTML */
7878
},
79-
true, /* Optional - Is the `pre` element styled as well as the `code` element? Changing this to false uses the code element as the scrollable one rather than the pre element */
80-
true, /* Optional - This is used for editing code - setting this to true sets the `code` element's class to `language-<the code-input's lang attribute>` */
81-
false /* Optional - Setting this to true passes the `<code-input>` element as a second argument to the highlight function to be used for getting data- attribute values and using the DOM for the code-input */,
79+
80+
true, /* Optional - Is the `pre` element styled as well as the `code` element?
81+
* Changing this to false uses the code element as the scrollable one rather
82+
* than the pre element */
83+
84+
true, /* Optional - This is used for editing code - setting this to true sets the `code`
85+
* element's class to `language-<the code-input's lang attribute>` */
86+
87+
false /* Optional - Setting this to true passes the `<code-input>` element as a second
88+
* argument to the highlight function to be used for getting data- attribute values
89+
* and using the DOM for the code-input */,
90+
91+
true /* Optional - Leaving this as true uses code-input's default fix for preventing duplicate
92+
* results in Ctrl+F searching from the input and result elements, and setting this to false
93+
* indicates your highlighting function implements its own fix. The default fix works by moving
94+
* text content from elements to CSS ::before pseudo-elements after highlighting. */
95+
8296
[] // Array of plugins (see below)
8397
));
8498
```

code-input.d.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,11 @@ export class Template {
164164
* @param {boolean} preElementStyled - is the `<pre>` element CSS-styled as well as the `<code>` element? If true, `<pre>` element's scrolling is synchronised; if false, `<code>` element's scrolling is synchronised.
165165
* @param {boolean} isCode - is this for writing code? If true, the code-input's lang HTML attribute can be used, and the `<code>` element will be given the class name 'language-[lang attribute's value]'.
166166
* @param {false} includeCodeInputInHighlightFunc - Setting this to true passes the `<code-input>` element as a second argument to the highlight function.
167+
* @param {boolean} autoDisableDuplicateSearching - Leaving this as true uses code-input's default fix for preventing duplicate results in Ctrl+F searching from the input and result elements, and setting this to false indicates your highlighting function implements its own fix. The default fix works by moving text content from elements to CSS `::before` pseudo-elements after highlighting.
167168
* @param {codeInput.Plugin[]} plugins - An array of plugin objects to add extra features - see `codeInput.Plugin`
168169
* @returns template object
169170
*/
170-
constructor(highlight?: (code: HTMLElement) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: false, plugins?: Plugin[])
171+
constructor(highlight?: (code: HTMLElement) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: false, autoDisableDuplicateSearching?: boolean, plugins?: Plugin[])
171172
/**
172173
* **When `includeCodeInputInHighlightFunc` is `true`, `highlight` takes two parameters: the `<pre><code>` element, and the `<code-input>` element.**
173174
*
@@ -177,15 +178,25 @@ export class Template {
177178
* @param {boolean} preElementStyled - is the `<pre>` element CSS-styled as well as the `<code>` element? If true, `<pre>` element's scrolling is synchronised; if false, `<code>` element's scrolling is synchronised.
178179
* @param {boolean} isCode - is this for writing code? If true, the code-input's lang HTML attribute can be used, and the `<code>` element will be given the class name 'language-[lang attribute's value]'.
179180
* @param {true} includeCodeInputInHighlightFunc - Setting this to true passes the `<code-input>` element as a second argument to the highlight function.
181+
* @param {boolean} autoDisableDuplicateSearching - Leaving this as true uses code-input's default fix for preventing duplicate results in Ctrl+F searching from the input and result elements, and setting this to false indicates your highlighting function implements its own fix. The default fix works by moving text content from elements to CSS `::before` pseudo-elements after highlighting.
180182
* @param {codeInput.Plugin[]} plugins - An array of plugin objects to add extra features - see `codeInput.Plugin`
181183
* @returns template object
182184
*/
183-
constructor(highlight?: (code: HTMLElement, codeInput: CodeInput) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: true, plugins?: Plugin[])
185+
constructor(highlight?: (code: HTMLElement, codeInput: CodeInput) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: true, autoDisableDuplicateSearching?: boolean, plugins?: Plugin[])
184186
highlight: Function
185187
preElementStyled: boolean
186188
isCode: boolean
187189
includeCodeInputInHighlightFunc: boolean
190+
autoDisableDuplicateSearching: boolean
188191
plugins: Plugin[]
192+
/**
193+
* @deprecated Please give a value for the `autoDisableDuplicateSearching` parameter.
194+
*/
195+
constructor(highlight?: (code: HTMLElement) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: false, plugins?: Plugin[])
196+
/**
197+
* @deprecated Please give a value for the `autoDisableDuplicateSearching` parameter.
198+
*/
199+
constructor(highlight?: (code: HTMLElement, codeInput: CodeInput) => void, preElementStyled?: boolean, isCode?: boolean, includeCodeInputInHighlightFunc?: true, plugins?: Plugin[])
189200
}
190201

191202
/**

code-input.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ var codeInput = {
211211

212212
/**
213213
* Leaving this as true uses code-input's default fix for preventing duplicate results in Ctrl+F searching
214-
* from the input and result elements, and setting this to true indicates your highlighting function implements
214+
* from the input and result elements, and setting this to false indicates your highlighting function implements
215215
* its own fix.
216216
*
217217
* The default fix works by moving text content from elements to CSS ::before pseudo-elements after highlighting.

0 commit comments

Comments
 (0)